diff --git a/.chronus/changes/python-spector-tests-arm-optemplate-clientapiversions-2026-7-27-8-55-0.md b/.chronus/changes/python-spector-tests-arm-optemplate-clientapiversions-2026-7-27-8-55-0.md new file mode 100644 index 00000000000..adc0284cc01 --- /dev/null +++ b/.chronus/changes/python-spector-tests-arm-optemplate-clientapiversions-2026-7-27-8-55-0.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Add mock API tests for new Spector scenarios: ARM operation templates (Legacy RoutedOperations, LRO on GET, POST LRO with paging body, POST action paging, markAsPageable) and `@clientApiVersions` decorator diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_api_version_client_api_versions_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_api_version_client_api_versions_async.py new file mode 100644 index 00000000000..64a7f61afb9 --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_api_version_client_api_versions_async.py @@ -0,0 +1,19 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +import pytest_asyncio +from azure.clientgenerator.core.apiversion.clientapiversions.aio import ClientApiVersionsClient + + +@pytest_asyncio.fixture +async def client(): + async with ClientApiVersionsClient(endpoint="http://localhost:3000", api_version="2022-10-01") as client: + yield client + + +@pytest.mark.asyncio +async def test_send_api_version(client: ClientApiVersionsClient): + await client.send_api_version() diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_api_version_client_api_versions.py b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_api_version_client_api_versions.py new file mode 100644 index 00000000000..5d4c4f65896 --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_api_version_client_api_versions.py @@ -0,0 +1,17 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +from azure.clientgenerator.core.apiversion.clientapiversions import ClientApiVersionsClient + + +@pytest.fixture +def client(): + with ClientApiVersionsClient(endpoint="http://localhost:3000", api_version="2022-10-01") as client: + yield client + + +def test_send_api_version(client: ClientApiVersionsClient): + client.send_api_version()