class TestRoleGeneric: @pytest.fixture(autouse=True) def setup_role(self): self.role = Role('test-role') self.role.create() def teardown_method(self): self.role.delete() def test_role_policy_attachment(self): policies = get_role_policies('test-role') assert len(policies) == 1 assert policies[ 0].arn == 'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole' def test_role_policy_detachment(self): self.role.detach_policies() policies = get_role_policies('test-role') assert len(policies) == 0 self.role.attach_policies() def test_repr(self): assert repr(self.role) == 'Role test-role'
def test_role_create(self): role = Role('test-role') with pytest.raises(AWSError): role.create()
def setup_role(self): role = Role('test-role') role.create()
def test_role_create(self): role = Role('test-role') role.create() assert role.get_role().name == 'test-role'