mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-21 23:29:47 +00:00
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:
commit
f01ec62a67
1 changed files with 6 additions and 0 deletions
|
@ -5344,6 +5344,7 @@ def test_ranged_request_response_code():
|
||||||
|
|
||||||
key.open('r', headers={'Range': 'bytes=4-7'})
|
key.open('r', headers={'Range': 'bytes=4-7'})
|
||||||
status = key.resp.status
|
status = key.resp.status
|
||||||
|
content_range = key.resp.getheader('Content-Range')
|
||||||
fetched_content = ''
|
fetched_content = ''
|
||||||
for data in key:
|
for data in key:
|
||||||
fetched_content += data;
|
fetched_content += data;
|
||||||
|
@ -5351,6 +5352,7 @@ def test_ranged_request_response_code():
|
||||||
|
|
||||||
eq(fetched_content, content[4:8])
|
eq(fetched_content, content[4:8])
|
||||||
eq(status, 206)
|
eq(status, 206)
|
||||||
|
eq(content_range, 'bytes 4-7/11')
|
||||||
|
|
||||||
@attr(resource='object')
|
@attr(resource='object')
|
||||||
@attr(method='get')
|
@attr(method='get')
|
||||||
|
@ -5366,6 +5368,7 @@ def test_ranged_request_skip_leading_bytes_response_code():
|
||||||
# test trailing bytes
|
# test trailing bytes
|
||||||
key.open('r', headers={'Range': 'bytes=4-'})
|
key.open('r', headers={'Range': 'bytes=4-'})
|
||||||
status = key.resp.status
|
status = key.resp.status
|
||||||
|
content_range = key.resp.getheader('Content-Range')
|
||||||
fetched_content = ''
|
fetched_content = ''
|
||||||
for data in key:
|
for data in key:
|
||||||
fetched_content += data;
|
fetched_content += data;
|
||||||
|
@ -5373,6 +5376,7 @@ def test_ranged_request_skip_leading_bytes_response_code():
|
||||||
|
|
||||||
eq(fetched_content, content[4:])
|
eq(fetched_content, content[4:])
|
||||||
eq(status, 206)
|
eq(status, 206)
|
||||||
|
eq(content_range, 'bytes 4-10/11')
|
||||||
|
|
||||||
@attr(resource='object')
|
@attr(resource='object')
|
||||||
@attr(method='get')
|
@attr(method='get')
|
||||||
|
@ -5388,6 +5392,7 @@ def test_ranged_request_return_trailing_bytes_response_code():
|
||||||
# test leading bytes
|
# test leading bytes
|
||||||
key.open('r', headers={'Range': 'bytes=-7'})
|
key.open('r', headers={'Range': 'bytes=-7'})
|
||||||
status = key.resp.status
|
status = key.resp.status
|
||||||
|
content_range = key.resp.getheader('Content-Range')
|
||||||
fetched_content = ''
|
fetched_content = ''
|
||||||
for data in key:
|
for data in key:
|
||||||
fetched_content += data;
|
fetched_content += data;
|
||||||
|
@ -5395,6 +5400,7 @@ def test_ranged_request_return_trailing_bytes_response_code():
|
||||||
|
|
||||||
eq(fetched_content, content[-7:])
|
eq(fetched_content, content[-7:])
|
||||||
eq(status, 206)
|
eq(status, 206)
|
||||||
|
eq(content_range, 'bytes 4-10/11')
|
||||||
|
|
||||||
@attr(resource='object')
|
@attr(resource='object')
|
||||||
@attr(method='get')
|
@attr(method='get')
|
||||||
|
|
Loading…
Reference in a new issue