From 10cd49b7fbafd11837cb134fddfbd4a236adf3a7 Mon Sep 17 00:00:00 2001 From: Sara Robinson Date: Thu, 12 Mar 2026 12:43:38 -0700 Subject: [PATCH] chore: add tests for private AE sessions methods PiperOrigin-RevId: 882728088 --- .../genai/replays/test_ae_session_delete.py | 32 +++++++++++++++++ .../replays/test_ae_session_private_create.py | 33 +++++++++++++++++ .../replays/test_ae_session_private_get.py | 32 +++++++++++++++++ .../replays/test_ae_session_private_update.py | 36 +++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 tests/unit/vertexai/genai/replays/test_ae_session_delete.py create mode 100644 tests/unit/vertexai/genai/replays/test_ae_session_private_create.py create mode 100644 tests/unit/vertexai/genai/replays/test_ae_session_private_get.py create mode 100644 tests/unit/vertexai/genai/replays/test_ae_session_private_update.py diff --git a/tests/unit/vertexai/genai/replays/test_ae_session_delete.py b/tests/unit/vertexai/genai/replays/test_ae_session_delete.py new file mode 100644 index 0000000000..f077cd26bf --- /dev/null +++ b/tests/unit/vertexai/genai/replays/test_ae_session_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_delete_session_non_blocking(client): + ae_session_operation = client.agent_engines.sessions.delete( + name=("reasoningEngines/2886612747586371584/sessions/8521561049109889024"), + ) + assert isinstance(ae_session_operation, types.DeleteAgentEngineSessionOperation) + + +pytestmark = pytest_helper.setup( + file=__file__, + globals_for_file=globals(), + test_method="agent_engines.sessions.delete", +) diff --git a/tests/unit/vertexai/genai/replays/test_ae_session_private_create.py b/tests/unit/vertexai/genai/replays/test_ae_session_private_create.py new file mode 100644 index 0000000000..1c4d17013f --- /dev/null +++ b/tests/unit/vertexai/genai/replays/test_ae_session_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_session(client): + ae_session_operation = client.agent_engines.sessions._create( + name="projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584", + user_id="test-user-id", + ) + assert isinstance(ae_session_operation, types.AgentEngineSessionOperation) + + +pytestmark = pytest_helper.setup( + file=__file__, + globals_for_file=globals(), + test_method="agent_engines.sessions._create", +) diff --git a/tests/unit/vertexai/genai/replays/test_ae_session_private_get.py b/tests/unit/vertexai/genai/replays/test_ae_session_private_get.py new file mode 100644 index 0000000000..5ac70531fd --- /dev/null +++ b/tests/unit/vertexai/genai/replays/test_ae_session_private_get.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_get_session_operation(client): + ae_session_operation = client.agent_engines.sessions._get_session_operation( + operation_name="reasoningEngines/2886612747586371584/sessions/3080649749292908544/operations/758783840595476480", + ) + assert isinstance(ae_session_operation, types.AgentEngineSessionOperation) + + +pytestmark = pytest_helper.setup( + file=__file__, + globals_for_file=globals(), + test_method="agent_engines.sessions._get_session_operation", +) diff --git a/tests/unit/vertexai/genai/replays/test_ae_session_private_update.py b/tests/unit/vertexai/genai/replays/test_ae_session_private_update.py new file mode 100644 index 0000000000..646e12bd5c --- /dev/null +++ b/tests/unit/vertexai/genai/replays/test_ae_session_private_update.py @@ -0,0 +1,36 @@ +# 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_session(client): + agent_engine_session_operation = client.agent_engines.sessions._update( + name="reasoningEngines/2886612747586371584/sessions/3080649749292908544", + config=types.UpdateAgentEngineSessionConfig( + display_name="test-agent-engine-session-updated", + user_id="test-user-id", + ), + ) + assert isinstance(agent_engine_session_operation, types.AgentEngineSessionOperation) + + +pytestmark = pytest_helper.setup( + file=__file__, + globals_for_file=globals(), + test_method="agent_engines.sessions._update", +)