Merge pull request #209 from fangyuxiangGL/compression

compression: add case to download range from big object

Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2018-02-16 11:34:00 -05:00 committed by GitHub
commit bb65f38ad9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6416,6 +6416,29 @@ def test_ranged_request_response_code():
eq(status, 206)
eq(content_range, 'bytes 4-7/11')
@attr(resource='object')
@attr(method='get')
@attr(operation='range')
@attr(assertion='returns correct data, 206')
def test_ranged_big_request_response_code():
bucket = get_new_bucket()
key = bucket.new_key('testobj')
string = os.urandom(8 * 1024 * 1024)
key.set_contents_from_string(string)
key.open('r', headers={'Range': 'bytes=3145728-5242880'})
status = key.resp.status
content_range = key.resp.getheader('Content-Range')
fetched_content = ''
for data in key:
fetched_content += data;
key.close()
eq(fetched_content, string[3145728:5242881])
eq(status, 206)
eq(content_range, 'bytes 3145728-5242880/8388608')
@attr(resource='object')
@attr(method='get')
@attr(operation='range')