def test_get_authentication_for_provider_errors(self): """Test to build Koku Provider authentication json obj with errors.""" test_matrix = [{ 'provider_type': 'AWS', 'authentication': { 'resource_namez': 'arn:fake' }, 'expected_response': KokuHTTPClientError }, { 'provider_type': 'OCP', 'authentication': { 'resource_namez': 'test-cluster-id' }, 'expected_response': KokuHTTPClientError }, { 'provider_type': 'AZURE', 'authentication': { 'credentialz': { 'foo': 'bar' } }, 'expected_response': KokuHTTPClientError }] client = KokuHTTPClient(auth_header=Config.SOURCES_FAKE_HEADER) for test in test_matrix: with self.assertRaises(test.get('expected_response')): client.get_authentication_for_provider( test.get('provider_type'), test.get('authentication'))
def test_get_authentication_for_provider_errors(self): """Test to build Koku Provider authentication json obj with errors.""" test_matrix = [ { "provider_type": Provider.PROVIDER_AWS, "authentication": { "resource_namez": "arn:fake" }, "expected_response": KokuHTTPClientError, }, { "provider_type": Provider.PROVIDER_OCP, "authentication": { "resource_namez": "test-cluster-id" }, "expected_response": KokuHTTPClientError, }, { "provider_type": Provider.PROVIDER_AZURE, "authentication": { "credentialz": { "foo": "bar" } }, "expected_response": KokuHTTPClientError, }, ] client = KokuHTTPClient(auth_header=Config.SOURCES_FAKE_HEADER) for test in test_matrix: with self.assertRaises(test.get("expected_response")): client.get_authentication_for_provider( test.get("provider_type"), test.get("authentication"))