From dc47b784a399484dee879292b16001b8c4f02402 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 29 Sep 2026 05:22:06 +0000 Subject: [PATCH 1/2] Initial plan From f2f530c366ec33f451e927bd1fcaf56a7869d865 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 29 Sep 2026 05:32:11 +0000 Subject: [PATCH 2/2] test(python): cover ARM resource IDs in multi-service specs Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> --- ...multiservice-resource-ids-2026-9-29-5-28-0.md | 7 +++++++ packages/http-client-python/package-lock.json | 10 +++++----- packages/http-client-python/package.json | 2 +- ...azure_resource_manager_multi_service_async.py | 16 ++++++++++++++++ ..._manager_multi_service_shared_models_async.py | 16 ++++++++++++++++ .../test_azure_resource_manager_multi_service.py | 16 ++++++++++++++++ ...source_manager_multi_service_shared_models.py | 16 ++++++++++++++++ 7 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 .chronus/changes/python-arm-multiservice-resource-ids-2026-9-29-5-28-0.md diff --git a/.chronus/changes/python-arm-multiservice-resource-ids-2026-9-29-5-28-0.md b/.chronus/changes/python-arm-multiservice-resource-ids-2026-9-29-5-28-0.md new file mode 100644 index 00000000000..6b6510e34f5 --- /dev/null +++ b/.chronus/changes/python-arm-multiservice-resource-ids-2026-9-29-5-28-0.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Add mock API assertions for ARM resource IDs in multi-service scenarios. diff --git a/packages/http-client-python/package-lock.json b/packages/http-client-python/package-lock.json index 9dd6477d71b..cb0aedf2e95 100644 --- a/packages/http-client-python/package-lock.json +++ b/packages/http-client-python/package-lock.json @@ -17,7 +17,7 @@ "tsx": "^4.23.13" }, "devDependencies": { - "@azure-tools/azure-http-specs": "0.1.0-alpha.45", + "@azure-tools/azure-http-specs": "0.1.0-alpha.46-dev.4", "@azure-tools/typespec-autorest": "~0.72.0", "@azure-tools/typespec-azure-core": "~0.72.0", "@azure-tools/typespec-azure-resource-manager": "~0.72.0", @@ -67,9 +67,9 @@ } }, "node_modules/@azure-tools/azure-http-specs": { - "version": "0.1.0-alpha.45", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/@azure-tools/azure-http-specs/-/azure-http-specs-0.1.0-alpha.45.tgz", - "integrity": "sha1-nxpqhlpgMEwA2O+fVIWLtweSELU=", + "version": "0.1.0-alpha.46-dev.4", + "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/@azure-tools/azure-http-specs/-/azure-http-specs-0.1.0-alpha.46-dev.4.tgz", + "integrity": "sha512-3uiDrUED0Zbf5OyUcXxvWLQba0flujD90CLcfQIHqVozg3G6kvc5vUcEV3G4dlFiqesoJAubr+OMAKLmKdYNVQ==", "dev": true, "license": "MIT", "dependencies": { @@ -80,7 +80,7 @@ "node": ">=22.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.72.0", + "@azure-tools/typespec-azure-core": "^0.72.0 || >= 0.73.0-dev.1", "@typespec/compiler": "^1.16.0", "@typespec/http": "^1.16.0", "@typespec/rest": "^0.86.0", diff --git a/packages/http-client-python/package.json b/packages/http-client-python/package.json index 5a56b3aa13c..8ecae563e06 100644 --- a/packages/http-client-python/package.json +++ b/packages/http-client-python/package.json @@ -109,7 +109,7 @@ "@azure-tools/typespec-azure-resource-manager": "~0.72.0", "@azure-tools/typespec-azure-rulesets": "~0.72.0", "@azure-tools/typespec-client-generator-core": "~0.72.1", - "@azure-tools/azure-http-specs": "0.1.0-alpha.45", + "@azure-tools/azure-http-specs": "0.1.0-alpha.46-dev.4", "@typespec/compiler": "^1.16.0", "@typespec/http": "^1.16.0", "@typespec/openapi": "^1.16.0", diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_resource_manager_multi_service_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_resource_manager_multi_service_async.py index b80c58a2274..d108446a6cb 100644 --- a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_resource_manager_multi_service_async.py +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_resource_manager_multi_service_async.py @@ -39,6 +39,10 @@ async def test_virtual_machines_get(client): assert result is not None assert isinstance(result, VirtualMachine) assert result.name == vm_name + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1" + ) @pytest.mark.asyncio @@ -65,6 +69,10 @@ async def test_virtual_machines_create_or_update(client): assert result is not None assert isinstance(result, VirtualMachine) assert result.location == "eastus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1" + ) @pytest.mark.asyncio @@ -83,6 +91,10 @@ async def test_disks_get(client): assert result is not None assert isinstance(result, Disk) assert result.name == disk_name + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1" + ) @pytest.mark.asyncio @@ -109,3 +121,7 @@ async def test_disks_create_or_update(client): assert result is not None assert isinstance(result, Disk) assert result.location == "eastus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1" + ) diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py index 57bc4929d90..57079cce399 100644 --- a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py @@ -39,6 +39,10 @@ async def test_virtual_machines_get(client): assert isinstance(result, VirtualMachine) assert result.name == vm_name assert result.location == "eastus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachinesShared/vm-shared1" + ) assert result.type == "Microsoft.Compute/virtualMachinesShared" assert result.properties is not None assert result.properties.provisioning_state == "Succeeded" @@ -73,6 +77,10 @@ async def test_virtual_machines_create_or_update(client): assert result is not None assert isinstance(result, VirtualMachine) assert result.location == "eastus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachinesShared/vm-shared1" + ) assert result.properties is not None assert result.properties.provisioning_state == "Succeeded" assert result.properties.metadata is not None @@ -92,6 +100,10 @@ async def test_storage_accounts_get(client): assert isinstance(result, StorageAccount) assert result.name == account_name assert result.location == "westus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/account1" + ) assert result.type == "Microsoft.Storage/storageAccounts" assert result.properties is not None assert result.properties.provisioning_state == "Succeeded" @@ -126,6 +138,10 @@ async def test_storage_accounts_create_or_update(client): assert result is not None assert isinstance(result, StorageAccount) assert result.location == "westus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/account1" + ) assert result.properties is not None assert result.properties.provisioning_state == "Succeeded" assert result.properties.metadata is not None diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_resource_manager_multi_service.py b/packages/http-client-python/tests/mock_api/azure/test_azure_resource_manager_multi_service.py index b56d0e4bfdd..b541f65e89f 100644 --- a/packages/http-client-python/tests/mock_api/azure/test_azure_resource_manager_multi_service.py +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_resource_manager_multi_service.py @@ -37,6 +37,10 @@ def test_virtual_machines_get(client): assert result is not None assert isinstance(result, VirtualMachine) assert result.name == vm_name + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1" + ) def test_virtual_machines_create_or_update(client): @@ -61,6 +65,10 @@ def test_virtual_machines_create_or_update(client): assert result is not None assert isinstance(result, VirtualMachine) assert result.location == "eastus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1" + ) def test_disks_get(client): @@ -78,6 +86,10 @@ def test_disks_get(client): assert result is not None assert isinstance(result, Disk) assert result.name == disk_name + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1" + ) def test_disks_create_or_update(client): @@ -102,3 +114,7 @@ def test_disks_create_or_update(client): assert result is not None assert isinstance(result, Disk) assert result.location == "eastus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1" + ) diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_resource_manager_multi_service_shared_models.py b/packages/http-client-python/tests/mock_api/azure/test_azure_resource_manager_multi_service_shared_models.py index 0e3f67ebc10..8cc8c0d85ce 100644 --- a/packages/http-client-python/tests/mock_api/azure/test_azure_resource_manager_multi_service_shared_models.py +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_resource_manager_multi_service_shared_models.py @@ -37,6 +37,10 @@ def test_virtual_machines_get(client): assert isinstance(result, VirtualMachine) assert result.name == vm_name assert result.location == "eastus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachinesShared/vm-shared1" + ) assert result.type == "Microsoft.Compute/virtualMachinesShared" assert result.properties is not None assert result.properties.provisioning_state == "Succeeded" @@ -70,6 +74,10 @@ def test_virtual_machines_create_or_update(client): assert result is not None assert isinstance(result, VirtualMachine) assert result.location == "eastus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachinesShared/vm-shared1" + ) assert result.properties is not None assert result.properties.provisioning_state == "Succeeded" assert result.properties.metadata is not None @@ -88,6 +96,10 @@ def test_storage_accounts_get(client): assert isinstance(result, StorageAccount) assert result.name == account_name assert result.location == "westus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/account1" + ) assert result.type == "Microsoft.Storage/storageAccounts" assert result.properties is not None assert result.properties.provisioning_state == "Succeeded" @@ -121,6 +133,10 @@ def test_storage_accounts_create_or_update(client): assert result is not None assert isinstance(result, StorageAccount) assert result.location == "westus" + assert ( + result.id + == "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/account1" + ) assert result.properties is not None assert result.properties.provisioning_state == "Succeeded" assert result.properties.metadata is not None