diff --git a/tests/unit/responses/roles/iam.ListRoleTags_1.json b/tests/unit/responses/roles/iam.ListRoleTags_1.json new file mode 100644 index 0000000..5ea9109 --- /dev/null +++ b/tests/unit/responses/roles/iam.ListRoleTags_1.json @@ -0,0 +1,16 @@ +{ + "status_code": 200, + "data": { + "Tags": [ + { + "Key": "Project", + "Value": "Marketing" + }, + { + "Key": "Env", + "Value": "Production" + } + ], + "IsTruncated": false + } +} diff --git a/tests/unit/responses/roles/iam.ListRoles_1.json b/tests/unit/responses/roles/iam.ListRoles_1.json new file mode 100644 index 0000000..cb7f72b --- /dev/null +++ b/tests/unit/responses/roles/iam.ListRoles_1.json @@ -0,0 +1,47 @@ +{ + "status_code": 200, + "data": { + "Roles": [ + { + "Path": "/", + "RoleName": "aws-elasticbeanstalk-ec2-role", + "RoleId": "AROA4TJGIIIZTEMWZ7AX5", + "Arn": "arn:aws:iam::123456789012:role/aws-elasticbeanstalk-ec2-role", + "CreateDate": "2020-07-09T06:02:54Z", + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "AWS": "arn:aws:iam::123456789012:root" + }, + "Action": "sts:AssumeRole" + } + ] + }, + "MaxSessionDuration": 3600 + }, + { + "Path": "/", + "RoleName": "aws-lambda-role", + "RoleId": "AROA4TJGIIIZTEMWZ7AX4", + "Arn": "arn:aws:iam::123456789012:role/aws-lambda-role", + "CreateDate": "2020-07-09T08:05:54Z", + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "AWS": "arn:aws:iam::123456789012:root" + }, + "Action": "sts:AssumeRole" + } + ] + }, + "MaxSessionDuration": 3600 + } + ] + } +} diff --git a/tests/unit/test_arn.py b/tests/unit/test_arn.py index 85f27c7..75108e9 100644 --- a/tests/unit/test_arn.py +++ b/tests/unit/test_arn.py @@ -212,6 +212,16 @@ def test_iam_users(self): 'arn:aws:iam::aws:policy/AdministratorAccess') self.assertEqual(l[0].data['SSHPublicKeys'][0]['SSHPublicKeyId'], 'APKAAAAAAAAAAAAAAAAA') + def test_iam_roles(self): + placebo_cfg = { + 'placebo': placebo, + 'placebo_dir': self._get_response_path('roles'), + 'placebo_mode': 'playback'} + arn = scan('arn:aws:iam::123456789012:role/*', + **placebo_cfg) + l = list(arn) + self.assertEqual(len(l), 2) + self.assertEqual(l[0].arn, 'arn:aws:iam::123456789012:role/aws-elasticbeanstalk-ec2-role') def test_cloudformation_stacks(self): placebo_cfg = {