8000 fix: fix a few unit tests · usingsystem007/adk-python@d5b3a89 · GitHub
[go: up one dir, main page]

Skip to content

Commit d5b3a89

Browse files
luaifeicopybara-github
authored andcommitted
fix: fix a few unit tests
Copybara import 8000 of the project: -- 93cc9c0 by luaifei <lu.aifei@thoughtworks.com>: fix: Update skipped tests in test_auth_handlers -- 06ddf55 by luaifei <lu.aifei@thoughtworks.com>: fix: Update skipped & failed tests in test_connections_client and test_streaming -- b8f2d35 by luaifei <lu.aifei@thoughtworks.com>: fix: Remove ignored test file from Python unit tests workflow COPYBARA_INTEGRATE_REVIEW=google#553 from luaifei:fix-tests d51e428 PiperOrigin-RevId: 755669644
1 parent e4317c9 commit d5b3a89

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@ jobs:
3636
source .venv/bin/activate
3737
pytest tests/unittests \
3838
--ignore=tests/unittests/artifacts/test_artifact_service.py \
39-
--ignore=tests/unittests/tools/application_integration_tool/clients/test_connections_client.py \
4039
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py
4140

tests/unittests/auth/test_auth_handler.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
import copy
1616
from unittest.mock import patch
1717

18+
import pytest
1819
from fastapi.openapi.models import APIKey
1920
from fastapi.openapi.models import APIKeyIn
2021
from fastapi.openapi.models import OAuth2
2122
from fastapi.openapi.models import OAuthFlowAuthorizationCode
2223
from fastapi.openapi.models import OAuthFlows
23-
import pytest
2424

2525
from google.adk.auth.auth_credential import AuthCredential
2626
from google.adk.auth.auth_credential import AuthCredentialTypes
@@ -58,7 +58,7 @@ def __init__(
5858
self.redirect_uri = redirect_uri
5959
self.state = state
6060

61-
def create_authorization_url(self, url):
61+
def create_authorization_url(self, url, **kwargs):
6262
return f"{url}?client_id={self.client_id}&scope={self.scope}", "mock_state"
6363

6464
def fetch_token(
@@ -238,7 +238,6 @@ def test_get_credential_key_with_extras(self, auth_config):
238238
class TestGenerateAuthUri:
239239
"""Tests for the generate_auth_uri method."""
240240

241-
@pytest.mark.skip(reason="broken tests")
242241
@patch("google.adk.auth.auth_handler.OAuth2Session", MockOAuth2Session)
243242
def test_generate_auth_uri_oauth2(self, auth_config):
244243
"""Test generating an auth URI for OAuth2."""
@@ -251,7 +250,6 @@ def test_generate_auth_uri_oauth2(self, auth_config):
251250
assert "client_id=mock_client_id" in result.oauth2.auth_uri
252251
assert result.oauth2.state == "mock_state"
253252

254-
@pytest.mark.skip(reason="broken tests")
255253
@patch("google.adk.auth.auth_handler.OAuth2Session", MockOAuth2Session)
256254
def test_generate_auth_uri_openid(
257255
self, openid_auth_scheme, oauth2_credentials

tests/unittests/streaming/test_streaming.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from .. import utils
2222

2323

24-
@pytest.mark.skip(reason='Streaming is hanging.')
2524
def test_streaming():
2625
response1 = LlmResponse(
2726
turn_complete=True,

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def test_get_connection_details_success_with_host(
195195
"serviceName": "tls_test_service",
196196
"host": "test.host",
197197
"authOverrideEnabled": True,
198+
"name": "",
198199
}
199200

200201
def test_get_connection_details_success_without_host(
@@ -217,6 +218,7 @@ def test_get_connection_details_success_without_host(
217218
"serviceName": "test_service",
218219
"host": "",
219220
"authOverrideEnabled": False,
221+
"name": "",
220222
}
221223

222224
def test_get_connection_details_error(
@@ -431,21 +433,21 @@ def test_get_operation_static(self):
431433
def test_create_operation(self):
432434
operation = ConnectionsClient.create_operation("Entity1", "test_tool")
433435
assert "post" in operation
434-
assert operation["post"]["summary"] == "Create Entity1"
436+
assert operation["post"]["summary"] == "Creates a new Entity1"
435437
assert "operationId" in operation["post"]
436438
assert operation["post"]["operationId"] == "test_tool_create_Entity1"
437439

438440
def test_update_operation(self):
439441
operation = ConnectionsClient.update_operation("Entity1", "test_tool")
440442
assert "post" in operation
441-
assert operation["post"]["summary"] == "Update Entity1"
443+
assert operation["post"]["summary"] == "Updates the Entity1"
442444
assert "operationId" in operation["post"]
443445
assert operation["post"]["operationId"] == "test_tool_update_Entity1"
444446

445447
def test_delete_operation(self):
446448
operation = ConnectionsClient.delete_operation("Entity1", "test_tool")
447449
assert "post" in operation
448-
assert operation["post"]["summary"] == "Delete Entity1"
450+
assert operation["post"]["summary"] == "Delete the Entity1"
449451
assert operation["post"]["operationId"] == "test_tool_delete_Entity1"
450452

451453
def test_create_operation_request(self):

0 commit comments

Comments
 (0)
0