Skip to content

Commit 4b42c76

Browse files
shawn-yang-googlecopybara-github
authored andcommitted
chore: GenAI SDK client: Move test_create_with_developer_connect_source to a dedicated test file.
PiperOrigin-RevId: 852979060
1 parent a2564cc commit 4b42c76

File tree

2 files changed

+66
-37
lines changed

2 files changed

+66
-37
lines changed

tests/unit/vertexai/genai/replays/test_create_agent_engine.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -170,43 +170,6 @@ def test_create_with_identity_type(client):
170170
client.agent_engines.delete(name=agent_engine.api_resource.name, force=True)
171171

172172

173-
def test_create_with_developer_connect_source(client):
174-
"""Tests creating an agent engine with developer connect source."""
175-
developer_connect_source_config = types.ReasoningEngineSpecSourceCodeSpecDeveloperConnectConfig(
176-
git_repository_link="projects/reasoning-engine-test-1/locations/europe-west3/connections/shawn-develop-connect/gitRepositoryLinks/shawn-yang-google-adk-samples",
177-
revision="main",
178-
dir="test",
179-
)
180-
agent_engine = client.agent_engines.create(
181-
config={
182-
"display_name": "test-agent-engine-dev-connect",
183-
"developer_connect_source": developer_connect_source_config,
184-
"entrypoint_module": "my_agent",
185-
"entrypoint_object": "agent",
186-
"class_methods": _TEST_CLASS_METHODS,
187-
"http_options": {
188-
"base_url": "https://europe-west3-aiplatform.googleapis.com",
189-
"api_version": "v1beta1",
190-
},
191-
},
192-
)
193-
assert agent_engine.api_resource.display_name == "test-agent-engine-dev-connect"
194-
assert (
195-
agent_engine.api_resource.spec.source_code_spec.developer_connect_source.config.git_repository_link
196-
== developer_connect_source_config.git_repository_link
197-
)
198-
assert (
199-
agent_engine.api_resource.spec.source_code_spec.developer_connect_source.config.revision
200-
== developer_connect_source_config.revision
201-
)
202-
assert (
203-
agent_engine.api_resource.spec.source_code_spec.developer_connect_source.config.dir
204-
== developer_connect_source_config.dir
205-
)
206-
# Clean up resources.
207-
client.agent_engines.delete(name=agent_engine.api_resource.name, force=True)
208-
209-
210173
pytestmark = pytest_helper.setup(
211174
file=__file__,
212175
globals_for_file=globals(),
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# pylint: disable=protected-access,bad-continuation,missing-function-docstring
16+
17+
from tests.unit.vertexai.genai.replays import pytest_helper
18+
from vertexai._genai import types
19+
20+
_TEST_CLASS_METHODS = [
21+
{"name": "query", "api_mode": ""},
22+
]
23+
24+
25+
def test_create_with_developer_connect_source(client):
26+
"""Tests creating an agent engine with developer connect source."""
27+
developer_connect_source_config = types.ReasoningEngineSpecSourceCodeSpecDeveloperConnectConfig(
28+
git_repository_link="projects/reasoning-engine-test-1/locations/europe-west3/connections/shawn-develop-connect/gitRepositoryLinks/shawn-yang-google-adk-samples",
29+
revision="main",
30+
dir="test",
31+
)
32+
agent_engine = client.agent_engines.create(
33+
config={
34+
"display_name": "test-agent-engine-dev-connect",
35+
"developer_connect_source": developer_connect_source_config,
36+
"entrypoint_module": "my_agent",
37+
"entrypoint_object": "agent",
38+
"class_methods": _TEST_CLASS_METHODS,
39+
"http_options": {
40+
"base_url": "https://europe-west3-aiplatform.googleapis.com",
41+
"api_version": "v1beta1",
42+
},
43+
},
44+
)
45+
assert agent_engine.api_resource.display_name == "test-agent-engine-dev-connect"
46+
assert (
47+
agent_engine.api_resource.spec.source_code_spec.developer_connect_source.config.git_repository_link
48+
== developer_connect_source_config.git_repository_link
49+
)
50+
assert (
51+
agent_engine.api_resource.spec.source_code_spec.developer_connect_source.config.revision
52+
== developer_connect_source_config.revision
53+
)
54+
assert (
55+
agent_engine.api_resource.spec.source_code_spec.developer_connect_source.config.dir
56+
== developer_connect_source_config.dir
57+
)
58+
# Clean up resources.
59+
client.agent_engines.delete(name=agent_engine.api_resource.name, force=True)
60+
61+
62+
pytestmark = pytest_helper.setup(
63+
file=__file__,
64+
globals_for_file=globals(),
65+
test_method="agent_engines.create",
66+
)

0 commit comments

Comments
 (0)