def test_s3_get_response_header_overrides(self):
    bucket_name = ('test-bucket-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket_name)
    object_key = 'key-by-hostname'
    client.put_object(Bucket=bucket_name, Key=object_key, Body='something')
    expiry_date = 'Wed, 21 Oct 2015 07:28:00 GMT'
    url = client.generate_presigned_url('get_object', Params={'Bucket': bucket_name, 'Key': object_key, 'ResponseCacheControl': 'max-age=74', 'ResponseContentDisposition': 'attachment; filename="foo.jpg"', 'ResponseContentEncoding': 'identity', 'ResponseContentLanguage': 'de-DE', 'ResponseContentType': 'image/jpeg', 'ResponseExpires': expiry_date})
    response = requests.get(url, verify=False)
    self.assertEqual(response.headers['cache-control'], 'max-age=74')
    self.assertEqual(response.headers['content-disposition'], 'attachment; filename="foo.jpg"')
    self.assertEqual(response.headers['content-encoding'], 'identity')
    self.assertEqual(response.headers['content-language'], 'de-DE')
    self.assertEqual(response.headers['content-type'], 'image/jpeg')
    possible_date_formats = ['2015-10-21T07:28:00Z', expiry_date]
    self.assertIn(response.headers['expires'], possible_date_formats)
    self._delete_bucket(bucket_name, [object_key])
def test_s3_get_response_header_overrides(self):
    bucket_name = ('test-bucket-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket_name)
    object_key = 'key-by-hostname'
    client.put_object(Bucket=bucket_name, Key=object_key, Body='something')
    expiry_date = 'Wed, 21 Oct 2015 07:28:00 GMT'
    url = client.generate_presigned_url('get_object', Params={'Bucket': bucket_name, 'Key': object_key, 'ResponseCacheControl': 'max-age=74', 'ResponseContentDisposition': 'attachment; filename="foo.jpg"', 'ResponseContentEncoding': 'identity', 'ResponseContentLanguage': 'de-DE', 'ResponseContentType': 'image/jpeg', 'ResponseExpires': expiry_date})
    response = requests.get(url, verify=False)
    self.assertEqual(response.headers['cache-control'], 'max-age=74')
    self.assertEqual(response.headers['content-disposition'], 'attachment; filename="foo.jpg"')
    self.assertEqual(response.headers['content-encoding'], 'identity')
    self.assertEqual(response.headers['content-language'], 'de-DE')
    self.assertEqual(response.headers['content-type'], 'image/jpeg')
    possible_date_formats = ['2015-10-21T07:28:00Z', expiry_date]
    self.assertIn(response.headers['expires'], possible_date_formats)
    self._delete_bucket(bucket_name, [object_key])