mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-13 15:14:50 -06:00
Copybara import of the project:
-- 8772b3de0b2fd04f246cc90c4c8032f9dc8cfed9 by Jaeyeon Kim <anencore94@gmail.com>: fix: update unit test code for test_connection - Fix for Unit Test Failures -- 8e0b45c2a64994bfda6401847e485fdd9edc8306 by Jaeyeon Kim <anencore94@gmail.com>: fix useless changes -- 54efa004fa0fc9bcf78b49061221994650e162bc by Jaeyeon Kim <anencore94@gmail.com>: fix conflict resolve issue -- 003ed4418c73b74bfba5ff055a364b62ddc18fa7 by Wei Sun (Jack) <weisun@google.com>: Autoformat test_connections_client.py COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/578 from anencore94:bugfix/failed_unittests ba0e1d33ad905b0b046023b685c70f4ef05e4efa PiperOrigin-RevId: 766221165
This commit is contained in:
parent
5c6001d90f
commit
b0403b2d98
3
.github/workflows/python-unit-tests.yml
vendored
3
.github/workflows/python-unit-tests.yml
vendored
@ -50,5 +50,4 @@ jobs:
|
|||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pytest tests/unittests \
|
pytest tests/unittests \
|
||||||
--ignore=tests/unittests/artifacts/test_artifact_service.py \
|
--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
|
||||||
|
|
||||||
|
@ -181,6 +181,7 @@ class TestConnectionsClient:
|
|||||||
mock_response = mock.MagicMock()
|
mock_response = mock.MagicMock()
|
||||||
mock_response.status_code = 200
|
mock_response.status_code = 200
|
||||||
mock_response.json.return_value = {
|
mock_response.json.return_value = {
|
||||||
|
"name": "test-connection",
|
||||||
"serviceDirectory": "test_service",
|
"serviceDirectory": "test_service",
|
||||||
"host": "test.host",
|
"host": "test.host",
|
||||||
"tlsServiceDirectory": "tls_test_service",
|
"tlsServiceDirectory": "tls_test_service",
|
||||||
@ -192,14 +193,38 @@ class TestConnectionsClient:
|
|||||||
):
|
):
|
||||||
details = client.get_connection_details()
|
details = client.get_connection_details()
|
||||||
assert details == {
|
assert details == {
|
||||||
|
"name": "test-connection",
|
||||||
"serviceName": "tls_test_service",
|
"serviceName": "tls_test_service",
|
||||||
"host": "test.host",
|
"host": "test.host",
|
||||||
"authOverrideEnabled": True,
|
"authOverrideEnabled": True,
|
||||||
"name": "",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_get_connection_details_success_without_host(
|
def test_get_connection_details_success_without_host(
|
||||||
self, project, location, connection_name, mock_credentials
|
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"}
|
credentials = {"email": "test@example.com"}
|
||||||
client = ConnectionsClient(project, location, connection_name, credentials)
|
client = ConnectionsClient(project, location, connection_name, credentials)
|
||||||
@ -215,10 +240,10 @@ class TestConnectionsClient:
|
|||||||
):
|
):
|
||||||
details = client.get_connection_details()
|
details = client.get_connection_details()
|
||||||
assert details == {
|
assert details == {
|
||||||
|
"name": "",
|
||||||
"serviceName": "test_service",
|
"serviceName": "test_service",
|
||||||
"host": "",
|
"host": "",
|
||||||
"authOverrideEnabled": False,
|
"authOverrideEnabled": False,
|
||||||
"name": "",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_get_connection_details_error(
|
def test_get_connection_details_error(
|
||||||
|
Loading…
Reference in New Issue
Block a user