Finish porting from nose to pytest.
This commit is contained in:
parent
77dc60ea97
commit
ea489bce6c
72 changed files with 1289 additions and 1280 deletions
|
|
@ -367,7 +367,7 @@ def test__create_alias__raises_if_reserved_alias():
|
|||
with pytest.raises(JSONResponseError) as err:
|
||||
kms.create_alias(alias_name, key_id)
|
||||
|
||||
ex = err.exception
|
||||
ex = err.value
|
||||
ex.error_message.should.be.none
|
||||
ex.error_code.should.equal("NotAuthorizedException")
|
||||
ex.body.should.equal({"__type": "NotAuthorizedException"})
|
||||
|
|
@ -395,7 +395,7 @@ def test__create_alias__raises_if_wrong_prefix():
|
|||
with pytest.raises(JSONResponseError) as err:
|
||||
kms.create_alias("wrongprefix/my-alias", key_id)
|
||||
|
||||
ex = err.exception
|
||||
ex = err.value
|
||||
ex.error_message.should.equal("Invalid identifier")
|
||||
ex.error_code.should.equal("ValidationException")
|
||||
ex.body.should.equal(
|
||||
|
|
@ -418,7 +418,7 @@ def test__create_alias__raises_if_duplicate():
|
|||
with pytest.raises(AlreadyExistsException) as err:
|
||||
kms.create_alias(alias, key_id)
|
||||
|
||||
ex = err.exception
|
||||
ex = err.value
|
||||
ex.error_message.should.match(
|
||||
r"An alias with the name arn:aws:kms:{region}:\d{{12}}:{alias} already exists".format(
|
||||
**locals()
|
||||
|
|
@ -452,7 +452,7 @@ def test__create_alias__raises_if_alias_has_restricted_characters():
|
|||
for alias_name in alias_names_with_restricted_characters:
|
||||
with pytest.raises(JSONResponseError) as err:
|
||||
kms.create_alias(alias_name, key_id)
|
||||
ex = err.exception
|
||||
ex = err.value
|
||||
ex.body["__type"].should.equal("ValidationException")
|
||||
ex.body["message"].should.equal(
|
||||
"1 validation error detected: Value '{alias_name}' at 'aliasName' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-zA-Z0-9:/_-]+$".format(
|
||||
|
|
@ -482,7 +482,7 @@ def test__create_alias__raises_if_alias_has_colon_character():
|
|||
for alias_name in alias_names_with_restricted_characters:
|
||||
with pytest.raises(JSONResponseError) as err:
|
||||
kms.create_alias(alias_name, key_id)
|
||||
ex = err.exception
|
||||
ex = err.value
|
||||
ex.body["__type"].should.equal("ValidationException")
|
||||
ex.body["message"].should.equal(
|
||||
"{alias_name} contains invalid characters for an alias".format(**locals())
|
||||
|
|
@ -517,7 +517,7 @@ def test__create_alias__raises_if_target_key_id_is_existing_alias():
|
|||
with pytest.raises(JSONResponseError) as err:
|
||||
kms.create_alias(alias, alias)
|
||||
|
||||
ex = err.exception
|
||||
ex = err.value
|
||||
ex.body["__type"].should.equal("ValidationException")
|
||||
ex.body["message"].should.equal("Aliases must refer to keys. Not aliases")
|
||||
ex.error_code.should.equal("ValidationException")
|
||||
|
|
@ -557,7 +557,7 @@ def test__delete_alias__raises_if_wrong_prefix():
|
|||
with pytest.raises(JSONResponseError) as err:
|
||||
kms.delete_alias("wrongprefix/my-alias")
|
||||
|
||||
ex = err.exception
|
||||
ex = err.value
|
||||
ex.body["__type"].should.equal("ValidationException")
|
||||
ex.body["message"].should.equal("Invalid identifier")
|
||||
ex.error_code.should.equal("ValidationException")
|
||||
|
|
@ -578,7 +578,7 @@ def test__delete_alias__raises_if_alias_is_not_found():
|
|||
expected_message_match = r"Alias arn:aws:kms:{region}:[0-9]{{12}}:{alias_name} is not found.".format(
|
||||
region=region, alias_name=alias_name
|
||||
)
|
||||
ex = err.exception
|
||||
ex = err.value
|
||||
ex.body["__type"].should.equal("NotFoundException")
|
||||
ex.body["message"].should.match(expected_message_match)
|
||||
ex.box_usage.should.be.none
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue