def test_s3_get_get_object_headers(self):
    object_key = 'sample.bin'
    bucket_name = ('test-%s' % short_uid())
    self.s3_client.create_bucket(Bucket=bucket_name)
    chunk_size = 1024
    with io.BytesIO() as data:
        data.write(os.urandom((chunk_size * 2)))
        data.seek(0)
        self.s3_client.upload_fileobj(data, bucket_name, object_key)
    range_header = ('bytes=0-%s' % (chunk_size - 1))
    resp = self.s3_client.get_object(Bucket=bucket_name, Key=object_key, Range=range_header)
    self.assertEqual(resp.get('AcceptRanges'), 'bytes')
    self.assertIn('x-amz-request-id', resp['ResponseMetadata']['HTTPHeaders'])
    self.assertIn('x-amz-id-2', resp['ResponseMetadata']['HTTPHeaders'])
    self.assertIn('content-language', resp['ResponseMetadata']['HTTPHeaders'])
    self.assertIn('cache-control', resp['ResponseMetadata']['HTTPHeaders'])
    self.assertIn('content-encoding', resp['ResponseMetadata']['HTTPHeaders'])
    self._delete_bucket(bucket_name, [object_key])
def test_s3_get_get_object_headers(self):
    object_key = 'sample.bin'
    bucket_name = ('test-%s' % short_uid())
    self.s3_client.create_bucket(Bucket=bucket_name)
    chunk_size = 1024
    with io.BytesIO() as data:
        data.write(os.urandom((chunk_size * 2)))
        data.seek(0)
        self.s3_client.upload_fileobj(data, bucket_name, object_key)
    range_header = ('bytes=0-%s' % (chunk_size - 1))
    resp = self.s3_client.get_object(Bucket=bucket_name, Key=object_key, Range=range_header)
    self.assertEqual(resp.get('AcceptRanges'), 'bytes')
    self.assertIn('x-amz-request-id', resp['ResponseMetadata']['HTTPHeaders'])
    self.assertIn('x-amz-id-2', resp['ResponseMetadata']['HTTPHeaders'])
    self.assertIn('content-language', resp['ResponseMetadata']['HTTPHeaders'])
    self.assertIn('cache-control', resp['ResponseMetadata']['HTTPHeaders'])
    self.assertIn('content-encoding', resp['ResponseMetadata']['HTTPHeaders'])
    self._delete_bucket(bucket_name, [object_key])