Revision 6e0f3e65 snf-pithos-app/pithos/api/test/__init__.py

b/snf-pithos-app/pithos/api/test/__init__.py
174 174
    def head(self, url, user='user', data={}, follow=False, **extra):
175 175
        with astakos_user(user):
176 176
            extra = dict((quote(k), quote(v)) for k, v in extra.items())
177
            extra.setdefault('HTTP_X_AUTH_TOKEN', 'token')
177 178
            response = self.client.head(url, data, follow, **extra)
178 179
        return response
179 180

  
180 181
    def get(self, url, user='user', data={}, follow=False, **extra):
181 182
        with astakos_user(user):
182 183
            extra = dict((quote(k), quote(v)) for k, v in extra.items())
184
            extra.setdefault('HTTP_X_AUTH_TOKEN', 'token')
183 185
            response = self.client.get(url, data, follow, **extra)
184 186
        return response
185 187

  
186 188
    def delete(self, url, user='user', data={}, follow=False, **extra):
187 189
        with astakos_user(user):
188 190
            extra = dict((quote(k), quote(v)) for k, v in extra.items())
191
            extra.setdefault('HTTP_X_AUTH_TOKEN', 'token')
189 192
            response = self.client.delete(url, data, follow, **extra)
190 193
        return response
191 194

  
......
193 196
             content_type='application/octet-stream', follow=False, **extra):
194 197
        with astakos_user(user):
195 198
            extra = dict((quote(k), quote(v)) for k, v in extra.items())
199
            extra.setdefault('HTTP_X_AUTH_TOKEN', 'token')
196 200
            response = self.client.post(url, data, content_type, follow,
197 201
                                        **extra)
198 202
        return response
......
201 205
            content_type='application/octet-stream', follow=False, **extra):
202 206
        with astakos_user(user):
203 207
            extra = dict((quote(k), quote(v)) for k, v in extra.items())
208
            extra.setdefault('HTTP_X_AUTH_TOKEN', 'token')
204 209
            response = self.client.put(url, data, content_type, follow,
205 210
                                       **extra)
206 211
        return response
......
218 223

  
219 224
    def delete_account_meta(self, meta, user=None):
220 225
        user = user or self.user
221
        transform = lambda k: 'HTTP_X_ACCOUNT_META_%s' % k.replace('-', '_').upper()
226
        transform = (lambda k: 'HTTP_X_ACCOUNT_META_%s' %
227
                     k.replace('-', '_').upper())
222 228
        kwargs = dict((transform(k), '') for k, v in meta.items())
223 229
        url = join_urls(self.pithos_path, user)
224 230
        r = self.post('%s?update=' % url, user=user, **kwargs)
......
230 236
    def delete_account_groups(self, groups, user=None):
231 237
        user = user or self.user
232 238
        url = join_urls(self.pithos_path, user)
233
        transform = lambda k: 'HTTP_X_ACCOUNT_GROUP_%s' % k.replace('-', '_').upper()
239
        transform = (lambda k: 'HTTP_X_ACCOUNT_GROUP_%s' %
240
                     k.replace('-', '_').upper())
234 241
        kwargs = dict((transform(k), '') for k, v in groups.items())
235 242
        r = self.post('%s?update=' % url, user=user, **kwargs)
236 243
        self.assertEqual(r.status_code, 202)
......
289 296
        url = join_urls(self.pithos_path, user, container)
290 297
        r = self.post('%s?update=' % url, user=user, **kwargs)
291 298
        self.assertEqual(r.status_code, 202)
292
        container_meta = self.get_container_meta(container)
299
        container_meta = self.get_container_meta(container, user=user)
293 300
        (self.assertTrue('X-Container-Meta-%s' % k in container_meta) for
294 301
            k in meta.keys())
295 302
        (self.assertEqual(container_meta['X-Container-Meta-%s' % k], v) for
......
437 444
        url = join_urls(self.pithos_path, user, container, object)
438 445
        r = self.post('%s?update=' % url, user=user, content_type='', **kwargs)
439 446
        self.assertEqual(r.status_code, 202)
440
        object_meta = self.get_object_meta(container, object)
447
        object_meta = self.get_object_meta(container, object, user=user)
441 448
        (self.assertTrue('X-Objecr-Meta-%s' % k in object_meta) for
442 449
            k in meta.keys())
443 450
        (self.assertEqual(object_meta['X-Object-Meta-%s' % k], v) for

Also available in: Unified diff