diff --git a/.github/workflows/python-unit-tests.yml b/.github/workflows/python-unit-tests.yml index b3689ed..a504fde 100644 --- a/.github/workflows/python-unit-tests.yml +++ b/.github/workflows/python-unit-tests.yml @@ -50,5 +50,4 @@ jobs: source .venv/bin/activate pytest tests/unittests \ --ignore=tests/unittests/artifacts/test_artifact_service.py \ - --ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py - + --ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py diff --git a/tests/unittests/tools/application_integration_tool/clients/test_connections_client.py b/tests/unittests/tools/application_integration_tool/clients/test_connections_client.py index fbb5a09..84f41ab 100644 --- a/tests/unittests/tools/application_integration_tool/clients/test_connections_client.py +++ b/tests/unittests/tools/application_integration_tool/clients/test_connections_client.py @@ -181,6 +181,7 @@ class TestConnectionsClient: mock_response = mock.MagicMock() mock_response.status_code = 200 mock_response.json.return_value = { + "name": "test-connection", "serviceDirectory": "test_service", "host": "test.host", "tlsServiceDirectory": "tls_test_service", @@ -192,14 +193,38 @@ class TestConnectionsClient: ): details = client.get_connection_details() assert details == { + "name": "test-connection", "serviceName": "tls_test_service", "host": "test.host", "authOverrideEnabled": True, - "name": "", } def test_get_connection_details_success_without_host( self, project, location, connection_name, mock_credentials + ): + credentials = {"email": "test@example.com"} + client = ConnectionsClient(project, location, connection_name, credentials) + mock_response = mock.MagicMock() + mock_response.status_code = 200 + mock_response.json.return_value = { + "name": "test-connection", + "serviceDirectory": "test_service", + "authOverrideEnabled": False, + } + + with mock.patch.object( + client, "_execute_api_call", return_value=mock_response + ): + details = client.get_connection_details() + assert details == { + "name": "test-connection", + "serviceName": "test_service", + "host": "", + "authOverrideEnabled": False, + } + + def test_get_connection_details_without_name( + self, project, location, connection_name, mock_credentials ): credentials = {"email": "test@example.com"} client = ConnectionsClient(project, location, connection_name, credentials) @@ -215,10 +240,10 @@ class TestConnectionsClient: ): details = client.get_connection_details() assert details == { + "name": "", "serviceName": "test_service", "host": "", "authOverrideEnabled": False, - "name": "", } def test_get_connection_details_error(