From 3d05ffa0b937d3d63a6d008c851098de0d6197d3 Mon Sep 17 00:00:00 2001 From: Sara Robinson Date: Thu, 12 Mar 2026 07:52:48 -0700 Subject: [PATCH] chore: add tests for private AE methods PiperOrigin-RevId: 882588681 --- .../test_agent_engine_private_create.py | 33 +++++++++++++++++++ .../test_agent_engine_private_delete.py | 32 ++++++++++++++++++ .../replays/test_agent_engine_private_get.py | 33 +++++++++++++++++++ .../test_agent_engine_private_update.py | 33 +++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 tests/unit/vertexai/genai/replays/test_agent_engine_private_create.py create mode 100644 tests/unit/vertexai/genai/replays/test_agent_engine_private_delete.py create mode 100644 tests/unit/vertexai/genai/replays/test_agent_engine_private_get.py create mode 100644 tests/unit/vertexai/genai/replays/test_agent_engine_private_update.py diff --git a/tests/unit/vertexai/genai/replays/test_agent_engine_private_create.py b/tests/unit/vertexai/genai/replays/test_agent_engine_private_create.py new file mode 100644 index 0000000000..12c9100318 --- /dev/null +++ b/tests/unit/vertexai/genai/replays/test_agent_engine_private_create.py @@ -0,0 +1,33 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# pylint: disable=protected-access,bad-continuation,missing-function-docstring + +from tests.unit.vertexai.genai.replays import pytest_helper +from vertexai._genai import types + + +def test_private_create_with_labels(client): + labels = {"test-label": "test-value"} + agent_engine_operation = client.agent_engines._create( + config={"labels": labels}, + ) + assert isinstance(agent_engine_operation, types.AgentEngineOperation) + + +pytestmark = pytest_helper.setup( + file=__file__, + globals_for_file=globals(), + test_method="agent_engines._create", +) diff --git a/tests/unit/vertexai/genai/replays/test_agent_engine_private_delete.py b/tests/unit/vertexai/genai/replays/test_agent_engine_private_delete.py new file mode 100644 index 0000000000..3a6f7d82fa --- /dev/null +++ b/tests/unit/vertexai/genai/replays/test_agent_engine_private_delete.py @@ -0,0 +1,32 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# pylint: disable=protected-access,bad-continuation,missing-function-docstring + +from tests.unit.vertexai.genai.replays import pytest_helper +from vertexai._genai import types + + +def test_private_delete(client): + agent_engine_operation = client.agent_engines._delete( + name="reasoningEngines/7571341522470174720", + ) + assert isinstance(agent_engine_operation, types.DeleteAgentEngineOperation) + + +pytestmark = pytest_helper.setup( + file=__file__, + globals_for_file=globals(), + test_method="agent_engines._delete", +) diff --git a/tests/unit/vertexai/genai/replays/test_agent_engine_private_get.py b/tests/unit/vertexai/genai/replays/test_agent_engine_private_get.py new file mode 100644 index 0000000000..9c7b08d6ac --- /dev/null +++ b/tests/unit/vertexai/genai/replays/test_agent_engine_private_get.py @@ -0,0 +1,33 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# pylint: disable=protected-access,bad-continuation,missing-function-docstring + +from tests.unit.vertexai.genai.replays import pytest_helper +from vertexai._genai import types + + +def test_private_get(client): + agent_engine = client.agent_engines._get( + name="reasoningEngines/2886612747586371584", + ) + assert isinstance(agent_engine, types.ReasoningEngine) + assert agent_engine.labels == {"test-label": "test-value"} + + +pytestmark = pytest_helper.setup( + file=__file__, + globals_for_file=globals(), + test_method="agent_engines._get", +) diff --git a/tests/unit/vertexai/genai/replays/test_agent_engine_private_update.py b/tests/unit/vertexai/genai/replays/test_agent_engine_private_update.py new file mode 100644 index 0000000000..b4b0914bdc --- /dev/null +++ b/tests/unit/vertexai/genai/replays/test_agent_engine_private_update.py @@ -0,0 +1,33 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# pylint: disable=protected-access,bad-continuation,missing-function-docstring + +from tests.unit.vertexai.genai.replays import pytest_helper +from vertexai._genai import types + + +def test_private_update(client): + agent_engine_operation = client.agent_engines._update( + name="reasoningEngines/2886612747586371584", + config=types.UpdateAgentEngineConfig(display_name="test-agent-engine-updated"), + ) + assert isinstance(agent_engine_operation, types.AgentEngineOperation) + + +pytestmark = pytest_helper.setup( + file=__file__, + globals_for_file=globals(), + test_method="agent_engines._update", +)