Esempio n. 1
0
 def test_get_schema(self):
     """Test provider schema getter."""
     uuid = self.aws_test_provider_uuid
     expected_schema = self.test_schema
     accessor = ProviderDBAccessor(uuid)
     self.assertEqual(expected_schema, accessor.get_schema())
     accessor.close_session()
Esempio n. 2
0
 def test_get_schema(self):
     """Test provider schema getter."""
     uuid = '6e212746-484a-40cd-bba0-09a19d132d64'
     expected_schema = 'testcustomer'
     accessor = ProviderDBAccessor(uuid)
     self.assertEqual(expected_schema, accessor.get_schema())
     accessor.close_session()
Esempio n. 3
0
    def get_accounts_from_source(self):
        """
        Retrieve all accounts from the Koku database.

        This will return a list of dicts for the Orchestrator to use to access reports.

        Args:
            None

        Returns:
            ([{}]) : A list of dicts

        """
        collector = ProviderCollector()
        all_providers = collector.get_providers()
        collector.close_session()

        accounts = []
        for provider in all_providers:
            provider_accessor = ProviderDBAccessor(provider.uuid)
            accounts.append({
                'authentication':
                provider_accessor.get_authentication(),
                'billing_source':
                provider_accessor.get_billing_source(),
                'customer_name':
                provider_accessor.get_customer_name(),
                'provider_type':
                provider_accessor.get_type(),
                'schema_name':
                provider_accessor.get_schema()
            })
            provider_accessor.close_session()
        return accounts