def test_get_user_name_or_id(self, boto_session): session = MagicMock(['client']) client = MagicMock(['get_user']) session.client.return_value = client boto_session.return_value = session iam = IAM({}) iam.client.client.get_user.return_value = {'UserName': '******', 'User': {'UserId': 'id'}} self.assertEqual(iam.get_user_name_or_id(), 'name')
def _get_all_functions(resources_info: Dict): arn_list = ResourceGroups(resources_info).get_resource_arn_list( IAM(resources_info).get_user_name_or_id()) return Lambda(resources_info).get_all_functions(arn_list)
def _get_owner(resources_info: Dict): return IAM(resources_info).get_user_name_or_id()
def test_init(self): ecr = IAM({}) self.assertEqual(type(ecr.client.client).__name__, "IAM")
def iam(self): iam = IAM(self.aws_properties) return iam