コード例 #1
0
ファイル: test_common.py プロジェクト: prasadanvekar/koku
    def test_parse_arn_with_region_and_account(self):
        """Assert successful account ID parsing from a well-formed ARN."""
        mock_account_id = fake_aws_account_id()
        mock_arn = fake_arn(account_id=mock_account_id, region='test-region-1')

        arn_object = utils.AwsArn(mock_arn)

        partition = arn_object.partition
        self.assertIsNotNone(partition)

        service = arn_object.service
        self.assertIsNotNone(service)

        region = arn_object.region
        self.assertIsNotNone(region)

        account_id = arn_object.account_id
        self.assertIsNotNone(account_id)

        resource_type = arn_object.resource_type
        self.assertIsNotNone(resource_type)

        resource_separator = arn_object.resource_separator
        self.assertIsNotNone(resource_separator)

        resource = arn_object.resource
        self.assertIsNotNone(resource)

        reconstructed_arn = ('arn:' + partition + ':' + service + ':' +
                             region + ':' + account_id + ':' + resource_type +
                             resource_separator + resource)

        self.assertEqual(mock_account_id, account_id)
        self.assertEqual(mock_arn, reconstructed_arn)
コード例 #2
0
ファイル: test_common.py プロジェクト: werwty/masu
 def setUp(self):
     """Setup the test."""
     super().setUp()
     self.account_id = fake_aws_account_id()
     self.arn = fake_arn(account_id=self.account_id,
                         region=REGION,
                         service='iam')
     with ReportingCommonDBAccessor() as common_accessor:
         self.column_map = common_accessor.column_map
コード例 #3
0
 def setUp(self):
     self.account_id = fake_aws_account_id()
     self.arn = fake_arn(account_id=self.account_id,
                         region=REGION,
                         service='iam')