Test Content-Range header in range requests

Signed-off-by: Andrew Gaul <andrew@gaul.org>
This commit is contained in:
Andrew Gaul 2015-06-17 08:26:15 -07:00
parent 6e70b4b511
commit f6329714cc

View file

@ -5344,6 +5344,7 @@ def test_ranged_request_response_code():
key.open('r', headers={'Range': 'bytes=4-7'})
status = key.resp.status
content_range = key.resp.getheader('Content-Range')
fetched_content = ''
for data in key:
fetched_content += data;
@ -5351,6 +5352,7 @@ def test_ranged_request_response_code():
eq(fetched_content, content[4:8])
eq(status, 206)
eq(content_range, 'bytes 4-7/11')
@attr(resource='object')
@attr(method='get')
@ -5366,6 +5368,7 @@ def test_ranged_request_skip_leading_bytes_response_code():
# test trailing bytes
key.open('r', headers={'Range': 'bytes=4-'})
status = key.resp.status
content_range = key.resp.getheader('Content-Range')
fetched_content = ''
for data in key:
fetched_content += data;
@ -5373,6 +5376,7 @@ def test_ranged_request_skip_leading_bytes_response_code():
eq(fetched_content, content[4:])
eq(status, 206)
eq(content_range, 'bytes 4-10/11')
@attr(resource='object')
@attr(method='get')
@ -5388,6 +5392,7 @@ def test_ranged_request_return_trailing_bytes_response_code():
# test leading bytes
key.open('r', headers={'Range': 'bytes=-7'})
status = key.resp.status
content_range = key.resp.getheader('Content-Range')
fetched_content = ''
for data in key:
fetched_content += data;
@ -5395,6 +5400,7 @@ def test_ranged_request_return_trailing_bytes_response_code():
eq(fetched_content, content[-7:])
eq(status, 206)
eq(content_range, 'bytes 4-10/11')
def check_can_test_multiregion():
if not targets.main.master or len(targets.main.secondaries) == 0: