attempt at fixing tests

This commit is contained in:
Simon-Pierre Gingras 2017-05-23 11:29:01 -07:00
parent 9b2c19c909
commit a2a6514936
2 changed files with 8 additions and 9 deletions

View File

@ -484,7 +484,7 @@ class ResponseObject(_TemplateEnvironmentMixin):
elif method == 'PUT': elif method == 'PUT':
return self._key_response_put(request, body, bucket_name, query, key_name, headers) return self._key_response_put(request, body, bucket_name, query, key_name, headers)
elif method == 'HEAD': 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': elif method == 'DELETE':
return self._key_response_delete(bucket_name, query, key_name, headers) return self._key_response_delete(bucket_name, query, key_name, headers)
elif method == 'POST': elif method == 'POST':
@ -597,7 +597,7 @@ class ResponseObject(_TemplateEnvironmentMixin):
response_headers = {} response_headers = {}
version_id = query.get('versionId', [None])[0] 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 if_modified_since:
if_modified_since = str_to_rfc_1123_datetime(if_modified_since) if_modified_since = str_to_rfc_1123_datetime(if_modified_since)

View File

@ -1277,7 +1277,6 @@ def test_boto3_head_object_if_modified_since():
key = 'hello.txt' key = 'hello.txt'
with freeze_time(datetime.datetime.now() - datetime.timedelta(hours=3)):
s3.put_object( s3.put_object(
Bucket=bucket_name, Bucket=bucket_name,
Key=key, Key=key,
@ -1288,7 +1287,7 @@ def test_boto3_head_object_if_modified_since():
s3.head_object( s3.head_object(
Bucket=bucket_name, Bucket=bucket_name,
Key=key, Key=key,
IfModifiedSince=datetime.datetime.now() - datetime.timedelta(hours=2) IfModifiedSince=datetime.datetime.utcnow() + datetime.timedelta(hours=1)
) )
e = err.exception e = err.exception
e.response['Error'].should.equal({'Code': '304', 'Message': 'Not Modified'}) e.response['Error'].should.equal({'Code': '304', 'Message': 'Not Modified'})