8000 Copybara import of the project: · NSFWExpert/adk-python@b0403b2 · GitHub
[go: up one dir, main page]

Skip to content < 8000 script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/keyboard-shortcuts-dialog-cf9f9950f389.js" defer="defer">

Commit b0403b2

Browse files
anencore94copybara-github
authored andcommitted
Copybara import of the project:
-- 8772b3d by Jaeyeon Kim <anencore94@gmail.com>: fix: update unit test code for test_connection - Fix for Unit Test Failures -- 8e0b45c by Jaeyeon Kim <anencore94@gmail.com>: fix useless changes -- 54efa00 by Jaeyeon Kim <anencore94@gmail.com>: fix conflict resolve issue -- 003ed44 by Wei Sun (Jack) <weisun@google.com>: Autoformat test_connections_client.py COPYBARA_INTEGRATE_REVIEW=google#578 from anencore94:bugfix/failed_unittests ba0e1d3 PiperOrigin-RevId: 766221165
1 parent 5c6001d commit b0403b2

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

.github/workflows/python-unit-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,4 @@ jobs:
5050
source .venv/bin/activate
5151
pytest tests/unittests \
5252
--ignore=tests/unittests/artifacts/test_artifact_service.py \
53-
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py
54-
53+
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py

tests/unittests/tools/application_integration_tool/clients/test_connections_client.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def test_get_connection_details_success_with_host(
181181
mock_response = mock.MagicMock()
182182
mock_response.status_code = 200
183183
mock_response.json.return_value = {
184+
"name": "test-connection",
184185
"serviceDirectory": "test_service",
185186
"host": "test.host",
186187
"tlsServiceDirectory": "tls_test_service",
@@ -192,10 +193,10 @@ def test_get_connection_details_success_with_host(
192193
):
193194
details = client.get_connection_details()
194195
assert details == {
196+
"name": "test-connection",
195197
"serviceName": "tls_test_service",
196198
"host": "test.host",
197199
"authOverrideEnabled": True,
198-
"name": "",
199200
}
200201

201202
def test_get_connection_details_success_without_host(
@@ -206,6 +207,7 @@ def test_get_connection_details_success_without_host(
206207
mock_response = mock.MagicMock()
207208
mock_response.status_code = 200
208209
mock_response.json.return_value = {
210+
"name": "test-connection",
209211
"serviceDirectory": "test_service",
210212
"authOverrideEnabled": False,
211213
}
@@ -215,10 +217,33 @@ def test_get_connection_details_success_without_host(
215217
):
216218
details = client.get_connection_details()
217219
assert details == {
220+
"name": "test-connection",
218221
"serviceName": "test_service",
219222
"host": "",
220223
"authOverrideEnabled": False,
224+
}
225+
226+
def test_get_connection_details_without_name(
227+
self, project, location, connection_name, mock_credentials
228+
):
229+
credentials = {"email": "test@example.com"}
230+
client = ConnectionsClient(project, location, connection_name, credentials)
231+
mock_response = mock.MagicMock()
232+
mock_response.status_code = 200
233+
mock_response.json.return_value = {
234+
"serviceDirectory": "test_service",
235+
"authOverrideEnabled": False,
236+
}
237+
238+
with mock.patch.object(
239+
client, "_execute_api_call", return_value=mock_response
240+
):
241+
details = client.get_connection_details()
242+
assert details == {
221243
"name": "",
244+
"serviceName": "test_service",
245+
"host": "",
246+
"authOverrideEnabled": False,
222247
}
223248

224249
def test_get_connection_details_error(

0 commit comments

Comments
 (0)
0