Merge pull request #61 from andrewgaul/range-get-content-range

Test Content-Range header in range requests

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2015-06-17 13:30:32 -07:00
commit f01ec62a67

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')
@attr(resource='object')
@attr(method='get')