From 8f83f51897853dd0829b8653bdc892fd9c214349 Mon Sep 17 00:00:00 2001 From: Brian Pandola Date: Fri, 4 Dec 2020 08:00:48 -0800 Subject: [PATCH] Refactor tests marked `xfail` to use proper assertions (#3515) --- tests/test_iam/test_iam.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/test_iam/test_iam.py b/tests/test_iam/test_iam.py index dd5a6991f..038169316 100644 --- a/tests/test_iam/test_iam.py +++ b/tests/test_iam/test_iam.py @@ -134,19 +134,21 @@ def test_delete_server_cert(): @mock_iam_deprecated() -@pytest.mark.xfail(raises=BotoServerError) def test_get_role__should_throw__when_role_does_not_exist(): conn = boto.connect_iam() - - conn.get_role("unexisting_role") + with pytest.raises(BotoServerError) as ex: + conn.get_role("unexisting_role") + ex.value.error_code.should.equal("NoSuchEntity") + ex.value.message.should.contain("not found") @mock_iam_deprecated() -@pytest.mark.xfail(raises=BotoServerError) def test_get_instance_profile__should_throw__when_instance_profile_does_not_exist(): conn = boto.connect_iam() - - conn.get_instance_profile("unexisting_instance_profile") + with pytest.raises(BotoServerError) as ex: + conn.get_instance_profile("unexisting_instance_profile") + ex.value.error_code.should.equal("NoSuchEntity") + ex.value.message.should.contain("not found") @mock_iam_deprecated()