This commit is contained in:
Bert Blommers 2020-11-11 15:55:37 +00:00
commit 273ca63d59
92 changed files with 515 additions and 1200 deletions

View file

@ -2397,9 +2397,7 @@ def test_boto3_get_object_if_match():
with pytest.raises(botocore.exceptions.ClientError) as err:
s3.get_object(
Bucket=bucket_name,
Key=key,
IfMatch='"hello"',
Bucket=bucket_name, Key=key, IfMatch='"hello"',
)
e = err.value
e.response["Error"]["Code"].should.equal("PreconditionFailed")
@ -2418,9 +2416,7 @@ def test_boto3_get_object_if_none_match():
with pytest.raises(botocore.exceptions.ClientError) as err:
s3.get_object(
Bucket=bucket_name,
Key=key,
IfNoneMatch=etag,
Bucket=bucket_name, Key=key, IfNoneMatch=etag,
)
e = err.value
e.response["Error"].should.equal({"Code": "304", "Message": "Not Modified"})
@ -2478,9 +2474,7 @@ def test_boto3_head_object_if_match():
with pytest.raises(botocore.exceptions.ClientError) as err:
s3.head_object(
Bucket=bucket_name,
Key=key,
IfMatch='"hello"',
Bucket=bucket_name, Key=key, IfMatch='"hello"',
)
e = err.value
e.response["Error"].should.equal({"Code": "412", "Message": "Precondition Failed"})
@ -2498,9 +2492,7 @@ def test_boto3_head_object_if_none_match():
with pytest.raises(botocore.exceptions.ClientError) as err:
s3.head_object(
Bucket=bucket_name,
Key=key,
IfNoneMatch=etag,
Bucket=bucket_name, Key=key, IfNoneMatch=etag,
)
e = err.value
e.response["Error"].should.equal({"Code": "304", "Message": "Not Modified"})
@ -4037,8 +4029,8 @@ def test_leading_slashes_not_removed(bucket_name):
e.value.response["Error"]["Code"].should.equal("NoSuchKey")
@pytest.mark.parametrize("key",
["foo/bar/baz", "foo", "foo/run_dt%3D2019-01-01%252012%253A30%253A00"]
@pytest.mark.parametrize(
"key", ["foo/bar/baz", "foo", "foo/run_dt%3D2019-01-01%252012%253A30%253A00"]
)
@mock_s3
def test_delete_objects_with_url_encoded_key(key):

View file

@ -14,12 +14,7 @@ def test_s3_bucket_cloudformation_basic():
template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"testInstance": {
"Type": "AWS::S3::Bucket",
"Properties": {},
}
},
"Resources": {"testInstance": {"Type": "AWS::S3::Bucket", "Properties": {},}},
"Outputs": {"Bucket": {"Value": {"Ref": "testInstance"}}},
}
template_json = json.dumps(template)

View file

@ -93,7 +93,8 @@ def test_parse_region_from_url():
parse_region_from_url(url).should.equal(expected)
@pytest.mark.parametrize("key,expected",
@pytest.mark.parametrize(
"key,expected",
[
("foo/bar/baz", "foo/bar/baz"),
("foo", "foo"),
@ -101,13 +102,14 @@ def test_parse_region_from_url():
"foo/run_dt%3D2019-01-01%252012%253A30%253A00",
"foo/run_dt=2019-01-01%2012%3A30%3A00",
),
]
],
)
def test_clean_key_name(key, expected):
clean_key_name(key).should.equal(expected)
@pytest.mark.parametrize("key,expected",
@pytest.mark.parametrize(
"key,expected",
[
("foo/bar/baz", "foo/bar/baz"),
("foo", "foo"),
@ -115,7 +117,7 @@ def test_clean_key_name(key, expected):
"foo/run_dt%3D2019-01-01%252012%253A30%253A00",
"foo/run_dt%253D2019-01-01%25252012%25253A30%25253A00",
),
]
],
)
def test_undo_clean_key_name(key, expected):
undo_clean_key_name(key).should.equal(expected)