mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
feat: disallow setting non-existent properties in BigQuery tools and credentials config
This will save the agent builder getting wrong impression if by mistake they set a property that does not exist. PiperOrigin-RevId: 803208559
This commit is contained in:
committed by
Copybara-Service
parent
ebf2c98e41
commit
45c1fcc84f
@@ -14,7 +14,7 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from google.adk.tools.bigquery.bigquery_credentials import BigQueryCredentialsConfig
|
||||
from google.adk.tools.bigquery import BigQueryCredentialsConfig
|
||||
# Mock the Google OAuth and API dependencies
|
||||
import google.auth.credentials
|
||||
import google.oauth2.credentials
|
||||
@@ -171,3 +171,12 @@ class TestBigQueryCredentials:
|
||||
),
|
||||
):
|
||||
BigQueryCredentialsConfig()
|
||||
|
||||
def test_invalid_property_raises_error(self):
|
||||
"""Test BigQueryCredentialsConfig raises exception when setting invalid property."""
|
||||
with pytest.raises(ValueError):
|
||||
BigQueryCredentialsConfig(
|
||||
client_id="test_client_id",
|
||||
client_secret="test_client_secret",
|
||||
non_existent_field="some value",
|
||||
)
|
||||
|
||||
@@ -27,8 +27,16 @@ def test_bigquery_tool_config_experimental_warning():
|
||||
BigQueryToolConfig()
|
||||
|
||||
|
||||
def test_bigquery_tool_config_invalid_property():
|
||||
"""Test BigQueryToolConfig raises exception when setting invalid property."""
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
):
|
||||
BigQueryToolConfig(non_existent_field="some value")
|
||||
|
||||
|
||||
def test_bigquery_tool_config_invalid_application_name():
|
||||
"""Test BigQueryToolConfig with invalid application name."""
|
||||
"""Test BigQueryToolConfig raises exception with invalid application name."""
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
match="Application name should not contain spaces.",
|
||||
|
||||
Reference in New Issue
Block a user