Revision 0a425890 pithos/api/tests.py

b/pithos/api/tests.py
155 155
    def update_account_meta(self, account, **metadata):
156 156
        path = '/v1/%s' % account
157 157
        response = self.client.post(path, **metadata)
158
        response.content = response.content.strip()
158
        response.content = response.content
159 159
        self.assert_status(response, 202)
160 160
        return response
161 161

  
......
166 166
        params.pop('container')
167 167
        path = '/v1/%s/%s' %(account, container)
168 168
        response = self.client.head(path, params)
169
        response.content = response.content.strip()
169
        response.content = response.content
170 170
        self.assert_status(response, 204)
171 171
        if response.status_code == 204:
172 172
            self.assert_headers(response, 'container', exp_meta)
......
190 190
    def create_container(self, account, name, **meta):
191 191
        path = '/v1/%s/%s' %(account, name)
192 192
        response = self.client.put(path, **meta)
193
        response.content = response.content.strip()
193
        response.content = response.content
194 194
        self.assert_status(response, [201, 202])
195 195
        return response
196 196

  
......
200 200
                                    data=None,
201 201
                                    content_type='text/xml',
202 202
                                    follow=False, **meta)
203
        response.content = response.content.strip()
203
        response.content = response.content
204 204
        self.assert_status(response, 202)
205 205
        return response
206 206

  
207 207
    def delete_container(self, account, container):
208 208
        path = '/v1/%s/%s' %(account, container)
209 209
        response = self.client.delete(path)
210
        response.content = response.content.strip()
210
        response.content = response.content
211 211
        self.assert_status(response, [204, 409])
212 212
        return response
213 213

  
214 214
    def get_object_meta(self, account, container, name):
215 215
        path = '/v1/%s/%s/%s' %(account, container, name)
216 216
        response = self.client.head(path)
217
        response.content = response.content.strip()
217
        response.content = response.content
218 218
        self.assert_status(response, 204)
219 219
        return response
220 220

  
221 221
    def get_object(self, account, container, name, format='', **headers):
222 222
        path = '/v1/%s/%s/%s' %(account, container, name)
223 223
        response = self.client.get(path, {'format':format}, **headers)
224
        response.content = response.content.strip()
224
        response.content = response.content
225 225
        self.assert_status(response, [200, 206, 304, 412, 416])
226 226
        if response.status_code in [200, 206]:
227 227
            self.assert_headers(response, 'object')
......
231 231
                      **headers):
232 232
        path = '/v1/%s/%s/%s' %(account, container, name)
233 233
        response = self.client.put(path, data, content_type, **headers)
234
        response.content = response.content.strip()
234
        response.content = response.content
235 235
        self.assert_status(response, [201, 411, 422])
236 236
        if response.status_code == 201:
237 237
            self.assertTrue(response['Etag'])
......
241 241
        path = '/v1/%s/%s/%s' %(account, container, name)
242 242
        headers['HTTP_X_COPY_FROM'] = src
243 243
        response = self.client.put(path, **headers)
244
        response.content = response.content.strip()
244
        response.content = response.content
245 245
        self.assert_status(response, 201)
246 246
        return response
247 247

  
......
249 249
        path = '/v1/%s/%s/%s' % (account, container, name)
250 250
        headers['HTTP_X_MOVE_FROM'] = src
251 251
        response = self.client.put(path, **headers)
252
        response.content = response.content.strip()
252
        response.content = response.content
253 253
        self.assert_status(response, 201)
254 254
        return response
255 255

  
......
257 257
                      content_type='MULTIPART_CONTENT', **headers):
258 258
        path = '/v1/%s/%s/%s' %(account, container, name)
259 259
        response = self.client.post(path, data, content_type, **headers)
260
        response.content = response.content.strip()
260
        response.content = response.content
261 261
        self.assert_status(response, [202, 204, 416])
262 262
        return response
263 263

  
264 264
    def delete_object(self, account, container, name):
265 265
        path = '/v1/%s/%s/%s' %(account, container, name)
266 266
        response = self.client.delete(path)
267
        response.content = response.content.strip()
267
        response.content = response.content
268 268
        self.assert_status(response, 204)
269 269
        return response
270 270

  
......
1310 1310
        data = f.read()
1311 1311
        hash = compute_md5_hash(data)
1312 1312
        meta={'HTTP_ETAG':hash,
1313
              'HTTP_X_OBJECT_MANIFEST':123,
1314 1313
              'HTTP_X_OBJECT_META_TEST':'test1'
1315 1314
              }
1316 1315
        type, enc = mimetypes.guess_type(fullpath)
......
1340 1339
        f = open(fullpath, 'r')
1341 1340
        data = f.read()
1342 1341
        meta={'HTTP_ETAG':'123',
1343
              'HTTP_X_OBJECT_MANIFEST':123,
1344 1342
              'HTTP_X_OBJECT_META_TEST':'test1'
1345 1343
              }
1346 1344
        type, enc = mimetypes.guess_type(fullpath)
......
1786 1784
           'photos/animals/cats/siamese.jpg',
1787 1785
           'photos/plants/fern.jpg',
1788 1786
           'photos/plants/rose.jpg',
1789
           'photos/me.jpg']
1787
           'photos/me.jpg']

Also available in: Unified diff