Adding the functionality and test so that the If-Modified-Since header is honored in GET Object
Signed-off-by: Aden Khan <aakhan@sep.com>
This commit is contained in:
parent
75d9707e8e
commit
b2adbf1f48
2 changed files with 28 additions and 1 deletions
|
|
@ -1596,6 +1596,28 @@ def test_boto3_delete_versioned_bucket():
|
|||
|
||||
client.delete_bucket(Bucket='blah')
|
||||
|
||||
@mock_s3
|
||||
def test_boto3_get_object_if_modified_since():
|
||||
s3 = boto3.client('s3', region_name='us-east-1')
|
||||
bucket_name = "blah"
|
||||
s3.create_bucket(Bucket=bucket_name)
|
||||
|
||||
key = 'hello.txt'
|
||||
|
||||
s3.put_object(
|
||||
Bucket=bucket_name,
|
||||
Key=key,
|
||||
Body='test'
|
||||
)
|
||||
|
||||
with assert_raises(botocore.exceptions.ClientError) as err:
|
||||
s3.get_object(
|
||||
Bucket=bucket_name,
|
||||
Key=key,
|
||||
IfModifiedSince=datetime.datetime.utcnow() + datetime.timedelta(hours=1)
|
||||
)
|
||||
e = err.exception
|
||||
e.response['Error'].should.equal({'Code': '304', 'Message': 'Not Modified'})
|
||||
|
||||
@mock_s3
|
||||
def test_boto3_head_object_if_modified_since():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue