attempt at fixing tests
This commit is contained in:
parent
9b2c19c909
commit
a2a6514936
@ -484,7 +484,7 @@ class ResponseObject(_TemplateEnvironmentMixin):
|
||||
elif method == 'PUT':
|
||||
return self._key_response_put(request, body, bucket_name, query, key_name, headers)
|
||||
elif method == 'HEAD':
|
||||
return self._key_response_head(bucket_name, query, key_name, headers)
|
||||
return self._key_response_head(bucket_name, query, key_name, headers=request.headers)
|
||||
elif method == 'DELETE':
|
||||
return self._key_response_delete(bucket_name, query, key_name, headers)
|
||||
elif method == 'POST':
|
||||
@ -597,7 +597,7 @@ class ResponseObject(_TemplateEnvironmentMixin):
|
||||
response_headers = {}
|
||||
version_id = query.get('versionId', [None])[0]
|
||||
|
||||
if_modified_since = headers.get('if-modified-since', None)
|
||||
if_modified_since = headers.get('If-Modified-Since', None)
|
||||
if if_modified_since:
|
||||
if_modified_since = str_to_rfc_1123_datetime(if_modified_since)
|
||||
|
||||
|
@ -1277,18 +1277,17 @@ def test_boto3_head_object_if_modified_since():
|
||||
|
||||
key = 'hello.txt'
|
||||
|
||||
with freeze_time(datetime.datetime.now() - datetime.timedelta(hours=3)):
|
||||
s3.put_object(
|
||||
Bucket=bucket_name,
|
||||
Key=key,
|
||||
Body='test'
|
||||
)
|
||||
s3.put_object(
|
||||
Bucket=bucket_name,
|
||||
Key=key,
|
||||
Body='test'
|
||||
)
|
||||
|
||||
with assert_raises(botocore.exceptions.ClientError) as err:
|
||||
s3.head_object(
|
||||
Bucket=bucket_name,
|
||||
Key=key,
|
||||
IfModifiedSince=datetime.datetime.now() - datetime.timedelta(hours=2)
|
||||
IfModifiedSince=datetime.datetime.utcnow() + datetime.timedelta(hours=1)
|
||||
)
|
||||
e = err.exception
|
||||
e.response['Error'].should.equal({'Code': '304', 'Message': 'Not Modified'})
|
||||
|
Loading…
Reference in New Issue
Block a user