Fix IAM role name when parsed from CloudFormation JSON.

This commit is contained in:
Luis Pollo 2018-11-07 15:58:26 -06:00 committed by Bert Blommers
commit 20364b177a
2 changed files with 7 additions and 4 deletions

View file

@ -909,6 +909,7 @@ def test_iam_roles():
},
"my-role-no-path": {
"Properties": {
"RoleName": "my-role-no-path-name",
"AssumeRolePolicyDocument": {
"Statement": [
{
@ -936,13 +937,13 @@ def test_iam_roles():
role_name_to_id = {}
for role_result in role_results:
role = iam_conn.get_role(role_result.role_name)
role.role_name.should.contain("my-role")
if "with-path" in role.role_name:
if "my-role" not in role.role_name:
role_name_to_id["with-path"] = role.role_id
role.path.should.equal("my-path")
len(role.role_name).should.equal(5) # Role name is not specified, so randomly generated - can't check exact name
else:
role_name_to_id["no-path"] = role.role_id
role.role_name.should.contain("no-path")
role.role_name.should.equal("my-role-no-path-name")
role.path.should.equal("/")
instance_profile_responses = iam_conn.list_instance_profiles()[