From 6e7bd088b30452bff0f1601cde089cdfd9a8ee4d Mon Sep 17 00:00:00 2001 From: William Rubel Date: Sun, 17 Feb 2019 16:04:28 -0600 Subject: [PATCH] Add test for roles --- tests/test_iam/test_iam.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_iam/test_iam.py b/tests/test_iam/test_iam.py index 85c51012f..f728f0dca 100644 --- a/tests/test_iam/test_iam.py +++ b/tests/test_iam/test_iam.py @@ -1176,3 +1176,21 @@ def test_update_role(): response = conn.update_role_description(RoleName="my-role", Description="test") assert response['Role']['RoleName'] == 'my-role' + +@mock_iam() +def test_list_entities_for_policy(): + conn = boto3.client('iam', region_name='us-east-1') + + with assert_raises(ClientError): + conn.delete_role(RoleName="my-role") + + conn.create_role(RoleName="my-role", AssumeRolePolicyDocument="some policy", Path="/my-path/") + + role = conn.get_role(RoleName="my-role") + arn = role.get('Role').get('Arn') + + response = conn.list_entities_for_policy( + PolicyArn=arn + ) + + assert response['PolicyGroups'][0]['GroupName'] == 'Dev'