Revision a1f429b2 snf-pithos-app/pithos/api/test/objects.py
b/snf-pithos-app/pithos/api/test/objects.py | ||
---|---|---|
247 | 247 |
r = self.get(url, HTTP_RANGE=ranges) |
248 | 248 |
self.assertEqual(r.status_code, 416) |
249 | 249 |
|
250 |
def test_get_with_if_match_with_md5(self):
|
|
250 |
def test_get_with_if_match(self): |
|
251 | 251 |
cname = self.containers[0] |
252 | 252 |
oname, odata = self.upload_object(cname, length=1024)[:-1] |
253 | 253 |
|
... | ... | |
267 | 267 |
# assert response content |
268 | 268 |
self.assertEqual(r.content, odata) |
269 | 269 |
|
270 |
def test_get_with_if_match_star_with_md5(self):
|
|
270 |
def test_get_with_if_match_star(self): |
|
271 | 271 |
cname = self.containers[0] |
272 | 272 |
oname, odata = self.upload_object(cname, length=1024)[:-1] |
273 | 273 |
|
... | ... | |
281 | 281 |
# assert response content |
282 | 282 |
self.assertEqual(r.content, odata) |
283 | 283 |
|
284 |
def test_get_with_multiple_if_match_without_md5(self):
|
|
284 |
def test_get_with_multiple_if_match(self): |
|
285 | 285 |
cname = self.containers[0] |
286 | 286 |
oname, odata = self.upload_object(cname, length=1024)[:-1] |
287 | 287 |
|
... | ... | |
311 | 311 |
r = self.get(url, HTTP_IF_MATCH=get_random_data(8)) |
312 | 312 |
self.assertEqual(r.status_code, 412) |
313 | 313 |
|
314 |
def test_if_none_match_without_md5(self):
|
|
314 |
def test_if_none_match(self): |
|
315 | 315 |
# upload object |
316 | 316 |
cname = self.containers[0] |
317 | 317 |
oname, odata = self.upload_object(cname, length=1024)[:-1] |
... | ... | |
339 | 339 |
# assert get success |
340 | 340 |
self.assertEqual(r.status_code, 200) |
341 | 341 |
|
342 |
def test_if_none_match_star_without_md5(self):
|
|
342 |
def test_if_none_match_star(self): |
|
343 | 343 |
# upload object |
344 | 344 |
cname = self.containers[0] |
345 | 345 |
oname, odata = self.upload_object(cname, length=1024)[:-1] |
... | ... | |
1123 | 1123 |
# update zero length object |
1124 | 1124 |
url = join_urls(self.pithos_path, self.user, self.container, dest) |
1125 | 1125 |
length = random.randint(1, 1024) |
1126 |
r = self.put(url, data=get_random_data(length)) |
|
1126 |
initial_data = get_random_data(length) |
|
1127 |
r = self.put(url, data=initial_data) |
|
1127 | 1128 |
self.assertEqual(r.status_code, 201) |
1128 | 1129 |
|
1129 | 1130 |
offset = random.randint(1, length - 2) |
... | ... | |
1135 | 1136 |
|
1136 | 1137 |
r = self.get(url) |
1137 | 1138 |
content = r.content |
1138 |
self.assertEqual(content[:offset], source_data[:offset]) |
|
1139 |
self.assertEqual(content[offset:upto + 1], |
|
1140 |
source_data[:upto - offset + 1]) |
|
1141 |
self.assertEqual(content[upto + 1:], source_data[upto + 1:]) |
|
1139 |
self.assertEqual(content, (initial_data[:offset] + |
|
1140 |
source_data[:upto - offset + 1] + |
|
1141 |
initial_data[upto + 1:])) |
|
1142 | 1142 |
|
1143 | 1143 |
|
1144 | 1144 |
class ObjectDelete(PithosAPITest): |
Also available in: Unified diff