def test_gets_iam_account_id(self): mock_iam_client = Mock() user_info = {'User': {'Arn': 'foo:bar:baz:qux:1234'}} mock_iam_client.get_user.return_value = user_info account_id = utils.get_account_id(mock_iam_client) self.assertEqual(account_id, '1234')
def test_gets_sts_account_id(self): mock_sts_client = Mock() user_info = {'Account': '1234'} mock_sts_client.get_caller_identity.return_value = user_info account_id = utils.get_account_id(mock_sts_client) self.assertEqual(account_id, '1234')
def test_gets_sts_account_id(self): mock_sts_client = mock.Mock() user_info = {'Account': '1234'} mock_sts_client.get_caller_identity.return_value = user_info account_id = utils.get_account_id(mock_sts_client) self.assertEqual(account_id, '1234')