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