Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/unit/customizations/emr/test_assume_role_policy.py
1569 views
1
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
# may not use this file except in compliance with the License. A copy of
5
# the License is located at
6
#
7
# http://aws.amazon.com/apache2.0/
8
#
9
# or in the "license" file accompanying this file. This file is
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
# ANY KIND, either express or implied. See the License for the specific
12
# language governing permissions and limitations under the License.
13
14
from awscli.testutils import unittest
15
from awscli.customizations.emr.createdefaultroles import assume_role_policy
16
17
18
class TestDefaultRoles(unittest.TestCase):
19
service_principal = "ec2.amazonaws.com"
20
expected_result = {
21
"Version": "2008-10-17",
22
"Statement": [
23
{
24
"Sid": "",
25
"Effect": "Allow",
26
"Principal": {"Service": "ec2.amazonaws.com"},
27
"Action": "sts:AssumeRole"
28
}
29
]
30
}
31
32
def test_assume_role_policy(self):
33
result = assume_role_policy(self.service_principal)
34
self.assertEqual(result, self.expected_result)
35
36
37
if __name__ == "__main__":
38
unittest.main()
39
40