using assert_raises

This commit is contained in:
Olabode Anise 2020-02-27 07:29:13 -05:00
parent 607e0a8452
commit 9227845121

View File

@ -34,14 +34,12 @@ def test_delete_parameter():
def test_delete_nonexistent_parameter():
client = boto3.client("ssm", region_name="us-east-1")
try:
with assert_raises(ClientError) as ex:
client.delete_parameter(Name="test_noexist")
raise RuntimeError("Should of failed")
except botocore.exceptions.ClientError as err:
err.operation_name.should.equal("DeleteParameter")
err.response["Error"]["Message"].should.equal(
"Parameter test_noexist not found."
)
ex.exception.response["Error"]["Code"].should.equal("ParameterNotFound")
ex.exception.response["Error"]["Message"].should.equal(
"Parameter test_noexist not found."
)
@mock_ssm