async def test_run_with_auth_async_none_token(
    integration_tool_with_auth, mock_rest_api_tool
):
  """Tests run_async when auth credential token is None."""
  input_args = {
      "user_id": "user456",
      "filter": "some_filter",
      "sortByColumns": ["a", "b"],
  }
  expected_call_args = {
      "user_id": "user456",
      "filter": "some_filter",
      "dynamic_auth_config": {"oauth2_auth_code_flow.access_token": {}},
      "connection_name": "test-conn",
      "service_name": "test-service",
      "host": "test.example.com",
      "entity": "TestEntity",
      "operation": "LIST",
      "action": "TestAction",
      "sortByColumns": ["a", "b"],
  }

  with mock.patch(
      "google.adk.tools.openapi_tool.openapi_spec_parser.rest_api_tool.ToolAuthHandler.from_tool_context"
  ) as mock_from_tool_context:
    mock_tool_auth_handler_instance = mock.MagicMock()
    mock_tool_auth_handler_instance.prepare_auth_credentials.return_value.state = (
        "done"
    )
    # Simulate an AuthCredential that would cause _prepare_dynamic_euc to return None
    mock_auth_credential_without_token = AuthCredential(
        auth_type=AuthCredentialTypes.HTTP,
        http=HttpAuth(
            scheme="bearer",
            credentials=HttpCredentials(token=None),  # Token is None
        ),
    )
    mock_tool_auth_handler_instance.prepare_auth_credentials.return_value.auth_credential = (
        mock_auth_credential_without_token
    )
    mock_from_tool_context.return_value = mock_tool_auth_handler_instance

    result = await integration_tool_with_auth.run_async(
        args=input_args, tool_context={}
    )

    mock_rest_api_tool.call.assert_called_once_with(
        args=expected_call_args, tool_context={}
    )
    assert result == {"status": "success", "data": "mock_data"}
Tests run_async when auth credential token is None.
tests/unittests/tools/application_integration_tool/test_integration_connector_tool.py