10000 chore: Fixes unittests/tools/application_integration_tool/test_applic… · wongjoey/adk-python@57de963 · GitHub
[go: up one dir, main page]

Skip to content

Commit 57de963

Browse files
Jacksunweicopybara-github
authored andcommitted
chore: Fixes unittests/tools/application_integration_tool/test_application_integration_toolset.py
PiperOrigin-RevId: 760019822
1 parent 729001f commit 57de963

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

tests/unittests/tools/application_integration_tool/test_application_integration_toolset.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
import json
1617
from unittest import mock
18+
1719
from fastapi.openapi.models import Operation
1820
from google.adk.agents.readonly_context import ReadonlyContext
1921
from google.adk.auth import AuthCredentialTypes
@@ -22,7 +24,8 @@
2224
from google.adk.tools.application_integration_tool.application_integration_toolset import ApplicationIntegrationToolset
2325
from google.adk.tools.application_integration_tool.integration_connector_tool import IntegrationConnectorTool
2426
from google.adk.tools.openapi_tool.auth.auth_helpers import dict_to_auth_scheme
25-
from google.adk.tools.openapi_tool.openapi_spec_parser import ParsedOperation, rest_api_tool
27+
from google.adk.tools.openapi_tool.openapi_spec_parser import ParsedOperation
28+
from google.adk.tools.openapi_tool.openapi_spec_parser import rest_api_tool
2629
from google.adk.tools.openapi_tool.openapi_spec_parser.openapi_spec_parser import OperationEndpoint
2730
import pytest
2831

@@ -489,7 +492,8 @@ def test_initialization_with_connection_details(
489492
)
490493

491494

492-
def test_init_with_connection_and_custom_auth(
495+
@pytest.mark.asyncio
496+
async def test_init_with_connection_and_custom_auth(
493497
mock_integration_client,
494498
mock_connections_client,
495499
mock_openapi_action_spec_parser,
@@ -548,16 +552,17 @@ def test_init_with_connection_and_custom_auth(
548552
tool_name, tool_instructions
549553
)
550554
mock_openapi_action_spec_parser.return_value.parse.assert_called_once()
551-
assert len(toolset.get_tools()) == 1
552-
assert toolset.get_tools()[0].name == "list_issues_operation"
553-
assert isinstance(toolset.get_tools()[0], IntegrationConnectorTool)
554-
assert toolset.get_tools()[0].action == "CustomAction"
555-
assert toolset.get_tools()[0].operation == "EXECUTE_ACTION"
556-
assert toolset.get_tools()[0].auth_scheme == oauth2_scheme
557-
assert toolset.get_tools()[0].auth_credential == auth_credential
555+
assert len(await toolset.get_tools()) == 1
556+
assert (await toolset.get_tools())[0].name == "list_issues_operation"
557+
assert isinstance((await toolset.get_tools())[0], IntegrationConnectorTool)
558+
assert (await toolset.get_tools())[0]._action == "CustomAction"
559+
assert (await toolset.get_tools())[0]._operation == "EXECUTE_ACTION"
560+
assert (await toolset.get_tools())[0]._auth_scheme == oauth2_scheme
561+
assert (await toolset.get_tools())[0]._auth_credential == auth_credential
558562

559563

560-
def test_init_with_connection_with_auth_override_disabled_and_custom_auth(
564+
@pytest.mark.asyncio
565+
async def test_init_with_connection_with_auth_override_disabled_and_custom_auth(
561566
mock_integration_client,
562567
mock_connections_client,
563568
mock_openapi_action_spec_parser,
@@ -616,10 +621,10 @@ def test_init_with_connection_with_auth_override_disabled_and_custom_auth(
616621
tool_name, tool_instructions
617622
)
618623
mock_openapi_action_spec_parser.return_value.parse.assert_called_once()
619-
assert len(toolset.get_tools()) == 1
620-
assert toolset.get_tools()[0].name == "list_issues_operation"
621-
assert isinstance(toolset.get_tools()[0], IntegrationConnectorTool)
622-
assert toolset.get_tools()[0].action == "CustomAction"
623-
assert toolset.get_tools()[0].operation == "EXECUTE_ACTION"
624-
assert not toolset.get_tools()[0].auth_scheme
625-
assert not toolset.get_tools()[0].auth_credential
624+
assert len(await toolset.get_tools()) == 1
625+
assert (await toolset.get_tools())[0].name == "list_issues_operation"
626+
assert isinstance((await toolset.get_tools())[0], IntegrationConnectorTool)
627+
assert (await toolset.get_tools())[0]._action == "CustomAction"
628+
assert (await toolset.get_tools())[0]._operation == "EXECUTE_ACTION"
629+
assert not (await toolset.get_tools())[0]._auth_scheme
630+
assert not (await toolset.get_tools())[0]._auth_credential

0 commit comments

Comments
 (0)
0