diff --git a/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md b/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md deleted file mode 100644 index 47ce56ebe73..00000000000 --- a/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Add sync and async mock API tests for the azure/client-generator-core/alternate-type Spector scenario diff --git a/.chronus/changes/add-python-multiple-services-tests-2026-6-10-8-56-11.md b/.chronus/changes/add-python-multiple-services-tests-2026-6-10-8-56-11.md new file mode 100644 index 00000000000..14c091683a4 --- /dev/null +++ b/.chronus/changes/add-python-multiple-services-tests-2026-6-10-8-56-11.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Add sync and async mock_api tests for the `service/multiple-services` Spector scenario and enable its regeneration. diff --git a/.chronus/changes/add-python-single-discriminator-no-subtypes-tests-2026-6-4-23-29-0.md b/.chronus/changes/add-python-single-discriminator-no-subtypes-tests-2026-6-4-23-29-0.md deleted file mode 100644 index ad64f253038..00000000000 --- a/.chronus/changes/add-python-single-discriminator-no-subtypes-tests-2026-6-4-23-29-0.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Add sync and async mock_api tests for the single-discriminator no-subtypes and body-root nested Spector scenarios from http-specs. diff --git a/.chronus/changes/add-visibility-head-model-test-2026-5-4-23-8-9.md b/.chronus/changes/add-visibility-head-model-test-2026-5-4-23-8-9.md deleted file mode 100644 index 26893a4c4dc..00000000000 --- a/.chronus/changes/add-visibility-head-model-test-2026-5-4-23-8-9.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Add test coverage for `headModel` scenario in `type/model/visibility` spec. diff --git a/.chronus/changes/payload-head-python-test-2026-4-17-22-55-53.md b/.chronus/changes/payload-head-python-test-2026-4-17-22-55-53.md deleted file mode 100644 index ee198e709bd..00000000000 --- a/.chronus/changes/payload-head-python-test-2026-4-17-22-55-53.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Add mock API test for `payload/head` scenario with `Content-Type` and `x-ms-meta` response headers. diff --git a/.chronus/changes/python-add-arm-managementgroup-armresourceidentifier-tests-2026-6-10-8-52-0.md b/.chronus/changes/python-add-arm-managementgroup-armresourceidentifier-tests-2026-6-10-8-52-0.md new file mode 100644 index 00000000000..d116b0ad28e --- /dev/null +++ b/.chronus/changes/python-add-arm-managementgroup-armresourceidentifier-tests-2026-6-10-8-52-0.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Add sync and async mock_api tests for the management group scoped resources and ARM resource identifier Spector scenarios from azure-http-specs. diff --git a/.chronus/changes/python-add-response-as-bool-test-2026-6-10-5-33-0.md b/.chronus/changes/python-add-response-as-bool-test-2026-6-10-5-33-0.md deleted file mode 100644 index 9c5937cf445..00000000000 --- a/.chronus/changes/python-add-response-as-bool-test-2026-6-10-5-33-0.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Add mock api test for azure client-generator-core response-as-bool spector case diff --git a/.chronus/changes/python-client-doc-test-2026-6-4-9-30-0.md b/.chronus/changes/python-client-doc-test-2026-6-4-9-30-0.md deleted file mode 100644 index 84dd98fac83..00000000000 --- a/.chronus/changes/python-client-doc-test-2026-6-4-9-30-0.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Add test for the `@clientDoc` decorator spector case (azure/client-generator-core/client-doc). diff --git a/.chronus/changes/python-reserved-operation-body-params-test-2026-4-28-23-10-0.md b/.chronus/changes/python-reserved-operation-body-params-test-2026-4-28-23-10-0.md deleted file mode 100644 index ad10ee1042b..00000000000 --- a/.chronus/changes/python-reserved-operation-body-params-test-2026-4-28-23-10-0.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Add mock API test cases for operation body parameters with reserved names (e.g., `items`) to verify the wire name is not mangled. diff --git a/.chronus/changes/python-usage-namespace-test-2026-5-26-23-18-25.md b/.chronus/changes/python-usage-namespace-test-2026-5-26-23-18-25.md deleted file mode 100644 index 255a67569a5..00000000000 --- a/.chronus/changes/python-usage-namespace-test-2026-5-26-23-18-25.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Add sync and async mock API tests for the Azure client-generator-core usage namespace usage scenario from azure-http-specs. diff --git a/cspell.yaml b/cspell.yaml index 42cc56da89c..d2e086c1875 100644 --- a/cspell.yaml +++ b/cspell.yaml @@ -251,6 +251,8 @@ words: - sdkcore - segmentof - serde + - servicea + - serviceb - setuppy - sfixed - shiki @@ -308,6 +310,7 @@ words: - venvtools - VITE - vitest + - vnet - VNEXT - vsix - vsmarketplace diff --git a/packages/http-client-python/CHANGELOG.md b/packages/http-client-python/CHANGELOG.md index 9bc37e53db5..c07dbe104c3 100644 --- a/packages/http-client-python/CHANGELOG.md +++ b/packages/http-client-python/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log - @typespec/http-client-python +## 0.31.1 + +### Bump dependencies + +- Bump dependencies of `@typespec/*` and `@azure-tools/*` to latest versions + ## 0.31.0 ### Features diff --git a/packages/http-client-python/eng/scripts/ci/regenerate-common.ts b/packages/http-client-python/eng/scripts/ci/regenerate-common.ts index ded02b8ef50..9b2defd0e8c 100644 --- a/packages/http-client-python/eng/scripts/ci/regenerate-common.ts +++ b/packages/http-client-python/eng/scripts/ci/regenerate-common.ts @@ -70,7 +70,7 @@ export interface BuildTaskGroupsOptions { // ---- Public constants ---- -export const SKIP_SPECS: string[] = ["type/file", "service/multiple-services"]; +export const SKIP_SPECS: string[] = ["type/file"]; export const SpecialFlags: Record> = { azure: { diff --git a/packages/http-client-python/package-lock.json b/packages/http-client-python/package-lock.json index 0e11eaaf605..5ad0d57671f 100644 --- a/packages/http-client-python/package-lock.json +++ b/packages/http-client-python/package-lock.json @@ -1,12 +1,12 @@ { "name": "@typespec/http-client-python", - "version": "0.31.0", + "version": "0.31.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@typespec/http-client-python", - "version": "0.31.0", + "version": "0.31.1", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -17,27 +17,27 @@ "tsx": "^4.21.0" }, "devDependencies": { - "@azure-tools/azure-http-specs": "0.1.0-alpha.42-dev.0", - "@azure-tools/typespec-autorest": "~0.68.0", - "@azure-tools/typespec-azure-core": "~0.68.0", - "@azure-tools/typespec-azure-resource-manager": "~0.68.0", - "@azure-tools/typespec-azure-rulesets": "~0.68.0", - "@azure-tools/typespec-client-generator-core": "~0.68.4", + "@azure-tools/azure-http-specs": "0.1.0-alpha.42", + "@azure-tools/typespec-autorest": "~0.69.0", + "@azure-tools/typespec-azure-core": "~0.69.0", + "@azure-tools/typespec-azure-resource-manager": "~0.69.0", + "@azure-tools/typespec-azure-rulesets": "~0.69.0", + "@azure-tools/typespec-client-generator-core": "~0.69.0", "@types/js-yaml": "~4.0.5", "@types/node": "~25.0.2", "@types/semver": "7.5.8", - "@typespec/compiler": "^1.12.0", - "@typespec/events": "~0.82.0", - "@typespec/http": "^1.12.0", - "@typespec/http-specs": "0.1.0-alpha.38-dev.1", - "@typespec/openapi": "^1.12.0", - "@typespec/rest": "~0.82.0", + "@typespec/compiler": "^1.13.0", + "@typespec/events": "~0.83.0", + "@typespec/http": "^1.13.0", + "@typespec/http-specs": "0.1.0-alpha.38", + "@typespec/openapi": "^1.13.0", + "@typespec/rest": "~0.83.0", "@typespec/spec-api": "0.1.0-alpha.14", "@typespec/spector": "0.1.0-alpha.25", - "@typespec/sse": "~0.82.0", - "@typespec/streams": "~0.82.0", - "@typespec/versioning": "~0.82.0", - "@typespec/xml": "~0.82.0", + "@typespec/sse": "~0.83.0", + "@typespec/streams": "~0.83.0", + "@typespec/versioning": "~0.83.0", + "@typespec/xml": "~0.83.0", "c8": "^10.1.3", "picocolors": "~1.1.1", "rimraf": "~6.1.2", @@ -49,63 +49,63 @@ "node": ">=22.0.0" }, "peerDependencies": { - "@azure-tools/typespec-autorest": ">=0.68.0 <1.0.0", - "@azure-tools/typespec-azure-core": ">=0.68.0 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.68.0 <1.0.0", - "@azure-tools/typespec-azure-rulesets": ">=0.68.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.68.4 <1.0.0", - "@typespec/compiler": "^1.12.0", - "@typespec/events": ">=0.82.0 <1.0.0", - "@typespec/http": "^1.12.0", - "@typespec/openapi": "^1.12.0", - "@typespec/rest": ">=0.82.0 <1.0.0", - "@typespec/sse": ">=0.82.0 <1.0.0", - "@typespec/streams": ">=0.82.0 <1.0.0", - "@typespec/versioning": ">=0.82.0 <1.0.0", - "@typespec/xml": ">=0.82.0 <1.0.0" + "@azure-tools/typespec-autorest": ">=0.69.0 <1.0.0", + "@azure-tools/typespec-azure-core": ">=0.69.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.69.0 <1.0.0", + "@azure-tools/typespec-azure-rulesets": ">=0.69.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.69.0 <1.0.0", + "@typespec/compiler": "^1.13.0", + "@typespec/events": ">=0.83.0 <1.0.0", + "@typespec/http": "^1.13.0", + "@typespec/openapi": "^1.13.0", + "@typespec/rest": ">=0.83.0 <1.0.0", + "@typespec/sse": ">=0.83.0 <1.0.0", + "@typespec/streams": ">=0.83.0 <1.0.0", + "@typespec/versioning": ">=0.83.0 <1.0.0", + "@typespec/xml": ">=0.83.0 <1.0.0" } }, "node_modules/@azure-tools/azure-http-specs": { - "version": "0.1.0-alpha.42-dev.0", - "resolved": "https://registry.npmjs.org/@azure-tools/azure-http-specs/-/azure-http-specs-0.1.0-alpha.42-dev.0.tgz", - "integrity": "sha512-Ps9zmf09b7HbG4WbNc1dymAlTDD2TuXt1l4rfSZOEeyQ0mqUdwZHATRBHboqV5i0XGttILYzd/zLXZsCBC6Kdg==", + "version": "0.1.0-alpha.42", + "resolved": "https://registry.npmjs.org/@azure-tools/azure-http-specs/-/azure-http-specs-0.1.0-alpha.42.tgz", + "integrity": "sha512-vQOAepoGK1lSc9ohAub+NM1MiLJS5swIA5Ya3TTIJ4KkD1x6j5msdSRMgNgb0rmux/WWrKTRtsFDAiOF1Z0HKg==", "dev": true, "license": "MIT", "dependencies": { - "@typespec/spec-api": "^0.1.0-alpha.14 || >=0.1.0-alpha.15-dev <0.1.0-alpha.15", - "@typespec/spector": "^0.1.0-alpha.25 || >=0.1.0-alpha.26-dev <0.1.0-alpha.26" + "@typespec/spec-api": "^0.1.0-alpha.14", + "@typespec/spector": "^0.1.0-alpha.25" }, "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.68.0 || >=0.69.0-dev <0.69.0", - "@typespec/compiler": "^1.12.0", - "@typespec/http": "^1.12.0", - "@typespec/rest": "^0.82.0 || >=0.83.0-dev <0.83.0", - "@typespec/versioning": "^0.82.0 || >=0.83.0-dev <0.83.0", - "@typespec/xml": "^0.82.0 || >=0.83.0-dev <0.83.0" + "@azure-tools/typespec-azure-core": "^0.69.0", + "@typespec/compiler": "^1.13.0", + "@typespec/http": "^1.13.0", + "@typespec/rest": "^0.83.0", + "@typespec/versioning": "^0.83.0", + "@typespec/xml": "^0.83.0" } }, "node_modules/@azure-tools/typespec-autorest": { - "version": "0.68.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.68.0.tgz", - "integrity": "sha512-ywcB68x0jOuplKg1u9ZpjOamHbIEEgAaMuXTP72cvWXE7q1eGLCN1DQx1Uk5ME8VLJKAX6cMOMHK4hcmg9tvuw==", + "version": "0.69.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.69.0.tgz", + "integrity": "sha512-6lOOe3NWfLI8M5NGLM1ZzIFRe34gVPj2GXzti9ag6o3fVpC6eMUfacv1sU4zmz9dkpKTdOUXNO5qm3DvqPRC8Q==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.68.0", - "@azure-tools/typespec-azure-resource-manager": "^0.68.0", - "@azure-tools/typespec-client-generator-core": "^0.68.0", - "@typespec/compiler": "^1.12.0", - "@typespec/http": "^1.12.0", - "@typespec/openapi": "^1.12.0", - "@typespec/rest": "^0.82.0", - "@typespec/versioning": "^0.82.0", - "@typespec/xml": "^0.82.0" + "@azure-tools/typespec-azure-core": "^0.69.0", + "@azure-tools/typespec-azure-resource-manager": "^0.69.0", + "@azure-tools/typespec-client-generator-core": "^0.69.0", + "@typespec/compiler": "^1.13.0", + "@typespec/http": "^1.13.0", + "@typespec/openapi": "^1.13.0", + "@typespec/rest": "^0.83.0", + "@typespec/versioning": "^0.83.0", + "@typespec/xml": "^0.83.0" }, "peerDependenciesMeta": { "@typespec/xml": { @@ -114,24 +114,24 @@ } }, "node_modules/@azure-tools/typespec-azure-core": { - "version": "0.68.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.68.0.tgz", - "integrity": "sha512-p0qUkRZav5fdQvGe2gSCvlgsvpM0y9xVhgH2GpXi5ZzpYfNGzxd8oZr8VOCP8mjMVfGQ3AtnowbmrHALEZgz7Q==", + "version": "0.69.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.69.0.tgz", + "integrity": "sha512-UNdPb/DgMvXqwWk9hb54QOAumCJ6u6GGy+bj3RIIT1Sht6FR9rIn8AQ/UQ7WtrhbJBoqvQo5dxtS565a9/VRZw==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0", - "@typespec/http": "^1.12.0", - "@typespec/rest": "^0.82.0" + "@typespec/compiler": "^1.13.0", + "@typespec/http": "^1.13.0", + "@typespec/rest": "^0.83.0" } }, "node_modules/@azure-tools/typespec-azure-resource-manager": { - "version": "0.68.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.68.0.tgz", - "integrity": "sha512-1zgXpOb/fGfB7SrFqawKasSOTIi9cZPWyK8V3RHyNWFZVQclEMGBzSvBHi6an4AEChqcjCSMh5MEr4BSujW4Ew==", + "version": "0.69.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.69.0.tgz", + "integrity": "sha512-q/kdsGhVpvn2wb3OedxFHg7hp+al3FynUAPsz2gwqJx62z6UGOEJhtYCWP3osatVgxvKRhhh8uYl5mHRMDFi3g==", "dev": true, "license": "MIT", "dependencies": { @@ -142,34 +142,34 @@ "node": ">=22.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.68.0", - "@typespec/compiler": "^1.12.0", - "@typespec/http": "^1.12.0", - "@typespec/openapi": "^1.12.0", - "@typespec/rest": "^0.82.0", - "@typespec/versioning": "^0.82.0" + "@azure-tools/typespec-azure-core": "^0.69.0", + "@typespec/compiler": "^1.13.0", + "@typespec/http": "^1.13.0", + "@typespec/openapi": "^1.13.0", + "@typespec/rest": "^0.83.0", + "@typespec/versioning": "^0.83.0" } }, "node_modules/@azure-tools/typespec-azure-rulesets": { - "version": "0.68.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.68.0.tgz", - "integrity": "sha512-cXZ3jiDNqJgpBQLguNgXjvAsvYo7VwtlQxFMzTr96gpoAiuBViH+3eOhVd5HA4H96NgAWSddTMHXZJZzcsnE5A==", + "version": "0.69.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.69.0.tgz", + "integrity": "sha512-+7KThtfHupWBDSwDR9rRHNmBb15gxACH8iPOOohRr1J28Gu25YWlz1G00r62X9VUBFLZTxYc4rQ2QCxPFT0uFw==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.68.0", - "@azure-tools/typespec-azure-resource-manager": "^0.68.0", - "@azure-tools/typespec-client-generator-core": "^0.68.0", - "@typespec/compiler": "^1.12.0" + "@azure-tools/typespec-azure-core": "^0.69.0", + "@azure-tools/typespec-azure-resource-manager": "^0.69.0", + "@azure-tools/typespec-client-generator-core": "^0.69.0", + "@typespec/compiler": "^1.13.0" } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.68.4", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.68.4.tgz", - "integrity": "sha512-p32EXsrSC9giZUNdsQ2gmvDENFIEW2E0zto3FmjBZ3OeB5wCw1ZAZ+KnO0rsoKFovBvHSsQatNCKJvM/x89AgA==", + "version": "0.69.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.69.0.tgz", + "integrity": "sha512-ro8zzOeiN/74r0wM19R77gzLtbfjIFgKgr1Rusii/vhCfJIoVC7IcqLxhbJl0RVkjyhRFKt4GCRAw4iurnrDnw==", "dev": true, "license": "MIT", "dependencies": { @@ -181,16 +181,16 @@ "node": ">=22.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.68.0", - "@typespec/compiler": "^1.12.0", - "@typespec/events": "^0.82.0", - "@typespec/http": "^1.12.0", - "@typespec/openapi": "^1.12.0", - "@typespec/rest": "^0.82.0", - "@typespec/sse": "^0.82.0", - "@typespec/streams": "^0.82.0", - "@typespec/versioning": "^0.82.0", - "@typespec/xml": "^0.82.0" + "@azure-tools/typespec-azure-core": "^0.69.0", + "@typespec/compiler": "^1.13.0", + "@typespec/events": "^0.83.0", + "@typespec/http": "^1.13.0", + "@typespec/openapi": "^1.13.0", + "@typespec/rest": "^0.83.0", + "@typespec/sse": "^0.83.0", + "@typespec/streams": "^0.83.0", + "@typespec/versioning": "^0.83.0", + "@typespec/xml": "^0.83.0" } }, "node_modules/@azure/abort-controller": { @@ -2384,9 +2384,9 @@ } }, "node_modules/@typespec/compiler": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-1.12.0.tgz", - "integrity": "sha512-hKCkHEEDdCpXFyOU8ln+TzBBwonFMbkeUV0zIc+vBETyO8p/Upui3XvEyLOyB4CpKUReHzGeGm3gcFjNc73ygg==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-1.13.0.tgz", + "integrity": "sha512-DonoHiyAMx0UjSmssqTrFtya+v97wny1aHcTLU5QF2wFzLATtcwUU9hbPC+eXhepuTunMOCHf8yk3pEsH6PZYA==", "dev": true, "license": "MIT", "dependencies": { @@ -2497,30 +2497,30 @@ } }, "node_modules/@typespec/events": { - "version": "0.82.0", - "resolved": "https://registry.npmjs.org/@typespec/events/-/events-0.82.0.tgz", - "integrity": "sha512-4gxwWndMVmYF6e5ETrwW6b77h1DsSc2ZiIbNo98XePaynD6yz/ooHKKtNKacjC2gmWhfRz1ArPioYn0YHvQkxw==", + "version": "0.83.0", + "resolved": "https://registry.npmjs.org/@typespec/events/-/events-0.83.0.tgz", + "integrity": "sha512-3EP1EIjdLgwStgd2rGWaF/QqY7YRAt+DIYnnYG2VsdPwa8s2t6K6eJ9YJDXveeHImAkHs+cpFuwxnjKMl4hOyw==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0" + "@typespec/compiler": "^1.13.0" } }, "node_modules/@typespec/http": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@typespec/http/-/http-1.12.0.tgz", - "integrity": "sha512-3Bb1M6VSuEVPWOecXj3h3I/ddMpb9cmKRQQq34oq7LatiK4fwVBp+EdWbqzEzaRUGHm9mZtqsMsxZf5FndT8dg==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/@typespec/http/-/http-1.13.0.tgz", + "integrity": "sha512-tf8XFddU6g1MZSAVCLC/0Xa4fNfUO0CcHe6PWpmC3bvUojxMnpRcERI2DdoRJ+aycB9Q+Z8wN8bJO3up6u+sCw==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0", - "@typespec/streams": "^0.82.0" + "@typespec/compiler": "^1.13.0", + "@typespec/streams": "^0.83.0" }, "peerDependenciesMeta": { "@typespec/streams": { @@ -2529,52 +2529,52 @@ } }, "node_modules/@typespec/http-specs": { - "version": "0.1.0-alpha.38-dev.1", - "resolved": "https://registry.npmjs.org/@typespec/http-specs/-/http-specs-0.1.0-alpha.38-dev.1.tgz", - "integrity": "sha512-FqvLW1nM5P0WBvA5TTghgrrxPYLPsjFA4fN4V4mKumuBDG4ty3+KjBpJvFZE3GVCIsXQqP+sF08YzC5nG3iV+g==", + "version": "0.1.0-alpha.38", + "resolved": "https://registry.npmjs.org/@typespec/http-specs/-/http-specs-0.1.0-alpha.38.tgz", + "integrity": "sha512-/DlR8P93iFhULlLYDUy+aSkOW2udDrHdIfdIHko8aFnmfC5QGXE2fcFphtNlJHCQEYTdZwfAxmBu/TsEygR8jw==", "dev": true, "license": "MIT", "dependencies": { - "@typespec/spec-api": "^0.1.0-alpha.14 || >= 0.1.0-dev.0", - "@typespec/spector": "^0.1.0-alpha.25 || >= 0.1.0-dev.0" + "@typespec/spec-api": "^0.1.0-alpha.14", + "@typespec/spector": "^0.1.0-alpha.25" }, "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0 || >= 1.13.0-dev.12", - "@typespec/http": "^1.12.0 || >= 1.13.0-dev.0", - "@typespec/rest": "^0.82.0 || >= 0.83.0-dev.0", - "@typespec/versioning": "^0.82.0 || >= 0.83.0-dev.0", - "@typespec/xml": "^0.82.0 || >= 0.83.0-dev.0" + "@typespec/compiler": "^1.13.0", + "@typespec/http": "^1.13.0", + "@typespec/rest": "^0.83.0", + "@typespec/versioning": "^0.83.0", + "@typespec/xml": "^0.83.0" } }, "node_modules/@typespec/openapi": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-1.12.0.tgz", - "integrity": "sha512-XtkCMPpzXFfuIzmx/BQrCMUCCk7d37lkqZe5ubJmvJ02Fr7yvAbofrgtNUZ1BbFe3TBBUS2nB3E3mjT3tE4zCQ==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-1.13.0.tgz", + "integrity": "sha512-omPc9n+LM2WvjYwnIf31RCxmG17fFUOVLBRsWg4T1mbcsNCj4grnNP7Lwt+irIZCiKtmLKxq3ViE7jYixCkZ3g==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0", - "@typespec/http": "^1.12.0" + "@typespec/compiler": "^1.13.0", + "@typespec/http": "^1.13.0" } }, "node_modules/@typespec/rest": { - "version": "0.82.0", - "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.82.0.tgz", - "integrity": "sha512-cKjKEd8lgE3EdU9b5xXLoSdKBcifITOhHS2n9LPbEG9w6APfWDWGdtUe4UKV3wxWq9HlT143wpECW7IjrPhjnA==", + "version": "0.83.0", + "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.83.0.tgz", + "integrity": "sha512-WMEwEe1kdaOdZ0c+ct5BVmTSBXkrPniUYDWCz3K52T4in2dNc7J6YGP6tL8bXgQz5B0CsP0VNO12N+UysQDsLw==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0", - "@typespec/http": "^1.12.0" + "@typespec/compiler": "^1.13.0", + "@typespec/http": "^1.13.0" } }, "node_modules/@typespec/spec-api": { @@ -2770,32 +2770,32 @@ } }, "node_modules/@typespec/sse": { - "version": "0.82.0", - "resolved": "https://registry.npmjs.org/@typespec/sse/-/sse-0.82.0.tgz", - "integrity": "sha512-4jBByfLsS7yQAIqmbLkfrw4XoPm9kOqawvW5gVXmKtnMMDYR0RmfBhsnAXBqhUXGbnFq0bDJGEw3GX+6k3mKnA==", + "version": "0.83.0", + "resolved": "https://registry.npmjs.org/@typespec/sse/-/sse-0.83.0.tgz", + "integrity": "sha512-04WNaju2rwBbcF5pG+HrKQtdcrmSGuTVziLHNA9XOqj1qM7Uon3+wo2g+ZZ3Z6tngfqQoTCPyDcRHqZtGRdNuw==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0", - "@typespec/events": "^0.82.0", - "@typespec/http": "^1.12.0", - "@typespec/streams": "^0.82.0" + "@typespec/compiler": "^1.13.0", + "@typespec/events": "^0.83.0", + "@typespec/http": "^1.13.0", + "@typespec/streams": "^0.83.0" } }, "node_modules/@typespec/streams": { - "version": "0.82.0", - "resolved": "https://registry.npmjs.org/@typespec/streams/-/streams-0.82.0.tgz", - "integrity": "sha512-cr/6h6VV/6OJeG8RNcSd0SDes5iEXiuGUcKGrMN6wF8qKTTrY2hXNhfqCCn3lamDOg00wbi7ke+laz6pHWN3tg==", + "version": "0.83.0", + "resolved": "https://registry.npmjs.org/@typespec/streams/-/streams-0.83.0.tgz", + "integrity": "sha512-wbO6sdH1Uf+UwjxxsWdHQkjJ3wwiYsAKI+L66qnDYVXAFe02sUdMKd0mxH5o9ipGXE52MZ+yvZ52vHAD+g3RFQ==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0" + "@typespec/compiler": "^1.13.0" } }, "node_modules/@typespec/ts-http-runtime": { @@ -2814,29 +2814,29 @@ } }, "node_modules/@typespec/versioning": { - "version": "0.82.0", - "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.82.0.tgz", - "integrity": "sha512-s8giuYQTQPniy2YxNfKXYpAU2Vm4L74TdOsbFWe0tG+jnOy/9tt7kKTH4QF1sB8nRvmjv8h31EoHtZYOPe1GvA==", + "version": "0.83.0", + "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.83.0.tgz", + "integrity": "sha512-nE66ta0ixpHB6FQpSzqnj8QnVfgFsxeK/4Xv+DxYx2nB/w18f6VjkF+hW+A/zs1tZIYvBZVbCNa/Rcr8zM6fhg==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0" + "@typespec/compiler": "^1.13.0" } }, "node_modules/@typespec/xml": { - "version": "0.82.0", - "resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.82.0.tgz", - "integrity": "sha512-/Bwlt7HwSltojSbalkh7hGRh/lB5aMJllnb7gAAf3xRPMlnmu5VJqDFFcbZKqDvkwgGXZX/xHo458c4kott5Ug==", + "version": "0.83.0", + "resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.83.0.tgz", + "integrity": "sha512-2/dtAD8jGPkIdwpQ1G1P+5+qdMPeafQiIKCd8NdAnOo0w9OZ59Io52jINm9HdN8+FcbOrqK8+B2N9rlPRj7PqA==", "dev": true, "license": "MIT", "engines": { "node": ">=22.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.12.0" + "@typespec/compiler": "^1.13.0" } }, "node_modules/@vitest/expect": { diff --git a/packages/http-client-python/package.json b/packages/http-client-python/package.json index 696ffe46cd2..9d23b841e5a 100644 --- a/packages/http-client-python/package.json +++ b/packages/http-client-python/package.json @@ -1,6 +1,6 @@ { "name": "@typespec/http-client-python", - "version": "0.31.0", + "version": "0.31.1", "author": "Microsoft Corporation", "description": "TypeSpec emitter for Python SDKs", "homepage": "https://typespec.io", @@ -60,20 +60,20 @@ "emitter" ], "peerDependencies": { - "@azure-tools/typespec-autorest": ">=0.68.0 <1.0.0", - "@azure-tools/typespec-azure-core": ">=0.68.0 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.68.0 <1.0.0", - "@azure-tools/typespec-azure-rulesets": ">=0.68.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.68.4 <1.0.0", - "@typespec/compiler": "^1.12.0", - "@typespec/http": "^1.12.0", - "@typespec/openapi": "^1.12.0", - "@typespec/rest": ">=0.82.0 <1.0.0", - "@typespec/versioning": ">=0.82.0 <1.0.0", - "@typespec/events": ">=0.82.0 <1.0.0", - "@typespec/sse": ">=0.82.0 <1.0.0", - "@typespec/streams": ">=0.82.0 <1.0.0", - "@typespec/xml": ">=0.82.0 <1.0.0" + "@azure-tools/typespec-autorest": ">=0.69.0 <1.0.0", + "@azure-tools/typespec-azure-core": ">=0.69.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.69.0 <1.0.0", + "@azure-tools/typespec-azure-rulesets": ">=0.69.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.69.0 <1.0.0", + "@typespec/compiler": "^1.13.0", + "@typespec/http": "^1.13.0", + "@typespec/openapi": "^1.13.0", + "@typespec/rest": ">=0.83.0 <1.0.0", + "@typespec/versioning": ">=0.83.0 <1.0.0", + "@typespec/events": ">=0.83.0 <1.0.0", + "@typespec/sse": ">=0.83.0 <1.0.0", + "@typespec/streams": ">=0.83.0 <1.0.0", + "@typespec/xml": ">=0.83.0 <1.0.0" }, "playgroundConfig": { "assets": [ @@ -98,24 +98,24 @@ "tsx": "^4.21.0" }, "devDependencies": { - "@azure-tools/typespec-autorest": "~0.68.0", - "@azure-tools/typespec-azure-core": "~0.68.0", - "@azure-tools/typespec-azure-resource-manager": "~0.68.0", - "@azure-tools/typespec-azure-rulesets": "~0.68.0", - "@azure-tools/typespec-client-generator-core": "~0.68.4", - "@azure-tools/azure-http-specs": "0.1.0-alpha.42-dev.0", - "@typespec/compiler": "^1.12.0", - "@typespec/http": "^1.12.0", - "@typespec/openapi": "^1.12.0", - "@typespec/rest": "~0.82.0", - "@typespec/versioning": "~0.82.0", - "@typespec/events": "~0.82.0", + "@azure-tools/typespec-autorest": "~0.69.0", + "@azure-tools/typespec-azure-core": "~0.69.0", + "@azure-tools/typespec-azure-resource-manager": "~0.69.0", + "@azure-tools/typespec-azure-rulesets": "~0.69.0", + "@azure-tools/typespec-client-generator-core": "~0.69.0", + "@azure-tools/azure-http-specs": "0.1.0-alpha.42", + "@typespec/compiler": "^1.13.0", + "@typespec/http": "^1.13.0", + "@typespec/openapi": "^1.13.0", + "@typespec/rest": "~0.83.0", + "@typespec/versioning": "~0.83.0", + "@typespec/events": "~0.83.0", "@typespec/spector": "0.1.0-alpha.25", "@typespec/spec-api": "0.1.0-alpha.14", - "@typespec/sse": "~0.82.0", - "@typespec/streams": "~0.82.0", - "@typespec/xml": "~0.82.0", - "@typespec/http-specs": "0.1.0-alpha.38-dev.1", + "@typespec/sse": "~0.83.0", + "@typespec/streams": "~0.83.0", + "@typespec/xml": "~0.83.0", + "@typespec/http-specs": "0.1.0-alpha.38", "@types/js-yaml": "~4.0.5", "@types/node": "~25.0.2", "@types/semver": "7.5.8", diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_commonproperties_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_commonproperties_async.py index 15b8038fefd..0882c317949 100644 --- a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_commonproperties_async.py +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_commonproperties_async.py @@ -12,6 +12,11 @@ SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000" RESOURCE_GROUP_NAME = "test-rg" +SIMPLE_ARM_ID = f"/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP_NAME}/providers/Microsoft.Network/virtualNetworks/myVnet" +ARM_ID_WITH_TYPE = SIMPLE_ARM_ID +ARM_ID_WITH_TYPE_AND_SCOPE = SIMPLE_ARM_ID +ARM_ID_WITH_ALL_SCOPES = f"/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP_NAME}/providers/Microsoft.Compute/virtualMachines/myVm" + @pytest_asyncio.fixture async def client(credential, authentication_policy): @@ -93,3 +98,39 @@ async def test_error_create_for_user_defined_error(client): except exceptions.HttpResponseError as e: assert e.status_code == 400 assert e.error.message == "Username should not contain only numbers." + + +@pytest.mark.asyncio +async def test_arm_resource_identifiers_get(client): + result = await client.arm_resource_identifiers.get( + resource_group_name=RESOURCE_GROUP_NAME, arm_resource_identifier_resource_name="armId" + ) + assert result.location == "eastus" + assert result.properties.provisioning_state == "Succeeded" + assert result.properties.simple_arm_id == SIMPLE_ARM_ID + assert result.properties.arm_id_with_type == ARM_ID_WITH_TYPE + assert result.properties.arm_id_with_type_and_scope == ARM_ID_WITH_TYPE_AND_SCOPE + assert result.properties.arm_id_with_all_scopes == ARM_ID_WITH_ALL_SCOPES + + +@pytest.mark.asyncio +async def test_arm_resource_identifiers_create_or_replace(client): + result = await client.arm_resource_identifiers.create_or_replace( + resource_group_name=RESOURCE_GROUP_NAME, + arm_resource_identifier_resource_name="armId", + resource=models.ArmResourceIdentifierResource( + location="eastus", + properties=models.ArmResourceIdentifierResourceProperties( + simple_arm_id=SIMPLE_ARM_ID, + arm_id_with_type=ARM_ID_WITH_TYPE, + arm_id_with_type_and_scope=ARM_ID_WITH_TYPE_AND_SCOPE, + arm_id_with_all_scopes=ARM_ID_WITH_ALL_SCOPES, + ), + ), + ) + assert result.location == "eastus" + assert result.properties.provisioning_state == "Succeeded" + assert result.properties.simple_arm_id == SIMPLE_ARM_ID + assert result.properties.arm_id_with_type == ARM_ID_WITH_TYPE + assert result.properties.arm_id_with_type_and_scope == ARM_ID_WITH_TYPE_AND_SCOPE + assert result.properties.arm_id_with_all_scopes == ARM_ID_WITH_ALL_SCOPES diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_managementgroup_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_managementgroup_async.py new file mode 100644 index 00000000000..f51c7d9c1e4 --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_managementgroup_async.py @@ -0,0 +1,82 @@ +# ------------------------------------------------------------------------- +# 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.resourcemanager.managementgroup.aio import ManagementGroupClient +from azure.resourcemanager.managementgroup import models + +MANAGEMENT_GROUP_ID = "test-mg" +RESOURCE_NAME = "resource" + + +@pytest_asyncio.fixture +async def client(credential, authentication_policy): + async with ManagementGroupClient( + credential, "http://localhost:3000", authentication_policy=authentication_policy + ) as client: + yield client + + +@pytest.mark.asyncio +async def test_management_group_child_resources_get(client): + result = await client.management_group_child_resources.get( + management_group_id=MANAGEMENT_GROUP_ID, management_group_child_resource_name=RESOURCE_NAME + ) + assert result.name == RESOURCE_NAME + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + + +@pytest.mark.asyncio +async def test_management_group_child_resources_create_or_update(client): + result = await ( + await client.management_group_child_resources.begin_create_or_update( + management_group_id=MANAGEMENT_GROUP_ID, + management_group_child_resource_name=RESOURCE_NAME, + resource=models.ManagementGroupChildResource( + properties=models.ManagementGroupChildResourceProperties(description="valid") + ), + polling_interval=0, + ) + ).result() + assert result.name == RESOURCE_NAME + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + + +@pytest.mark.asyncio +async def test_management_group_child_resources_update(client): + result = await client.management_group_child_resources.update( + management_group_id=MANAGEMENT_GROUP_ID, + management_group_child_resource_name=RESOURCE_NAME, + properties=models.ManagementGroupChildResource( + properties=models.ManagementGroupChildResourceProperties(description="valid2") + ), + ) + assert result.name == RESOURCE_NAME + assert result.properties.description == "valid2" + assert result.properties.provisioning_state == "Succeeded" + + +@pytest.mark.asyncio +async def test_management_group_child_resources_delete(client): + await client.management_group_child_resources.delete( + management_group_id=MANAGEMENT_GROUP_ID, management_group_child_resource_name=RESOURCE_NAME + ) + + +@pytest.mark.asyncio +async def test_management_group_child_resources_list_by_management_group(client): + result = [ + item + async for item in client.management_group_child_resources.list_by_management_group( + management_group_id=MANAGEMENT_GROUP_ID + ) + ] + assert len(result) == 1 + assert result[0].name == RESOURCE_NAME + assert result[0].properties.description == "valid" + assert result[0].properties.provisioning_state == "Succeeded" diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_service_multiple_services_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_service_multiple_services_async.py new file mode 100644 index 00000000000..df3a090325c --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_service_multiple_services_async.py @@ -0,0 +1,41 @@ +# ------------------------------------------------------------------------- +# 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 service.multipleservices.servicea.aio import ServiceAClient +from service.multipleservices.serviceb.aio import ServiceBClient + + +@pytest_asyncio.fixture +async def client_a(): + async with ServiceAClient() as client: + yield client + + +@pytest_asyncio.fixture +async def client_b(): + async with ServiceBClient() as client: + yield client + + +@pytest.mark.asyncio +async def test_service_a_op(client_a: ServiceAClient): + await client_a.operations.op_a() + + +@pytest.mark.asyncio +async def test_service_a_sub_namespace_op(client_a: ServiceAClient): + await client_a.sub_namespace.sub_op_a() + + +@pytest.mark.asyncio +async def test_service_b_op(client_b: ServiceBClient): + await client_b.operations.op_b() + + +@pytest.mark.asyncio +async def test_service_b_sub_namespace_op(client_b: ServiceBClient): + await client_b.sub_namespace.sub_op_b() diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_arm_commonproperties.py b/packages/http-client-python/tests/mock_api/azure/test_azure_arm_commonproperties.py index fab853d096f..3b44eefa869 100644 --- a/packages/http-client-python/tests/mock_api/azure/test_azure_arm_commonproperties.py +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_arm_commonproperties.py @@ -11,6 +11,11 @@ SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000" RESOURCE_GROUP_NAME = "test-rg" +SIMPLE_ARM_ID = f"/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP_NAME}/providers/Microsoft.Network/virtualNetworks/myVnet" +ARM_ID_WITH_TYPE = SIMPLE_ARM_ID +ARM_ID_WITH_TYPE_AND_SCOPE = SIMPLE_ARM_ID +ARM_ID_WITH_ALL_SCOPES = f"/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP_NAME}/providers/Microsoft.Compute/virtualMachines/myVm" + @pytest.fixture def client(credential, authentication_policy): @@ -87,3 +92,37 @@ def test_error_create_for_user_defined_error(client): except exceptions.HttpResponseError as e: assert e.status_code == 400 assert e.error.message == "Username should not contain only numbers." + + +def test_arm_resource_identifiers_get(client): + result = client.arm_resource_identifiers.get( + resource_group_name=RESOURCE_GROUP_NAME, arm_resource_identifier_resource_name="armId" + ) + assert result.location == "eastus" + assert result.properties.provisioning_state == "Succeeded" + assert result.properties.simple_arm_id == SIMPLE_ARM_ID + assert result.properties.arm_id_with_type == ARM_ID_WITH_TYPE + assert result.properties.arm_id_with_type_and_scope == ARM_ID_WITH_TYPE_AND_SCOPE + assert result.properties.arm_id_with_all_scopes == ARM_ID_WITH_ALL_SCOPES + + +def test_arm_resource_identifiers_create_or_replace(client): + result = client.arm_resource_identifiers.create_or_replace( + resource_group_name=RESOURCE_GROUP_NAME, + arm_resource_identifier_resource_name="armId", + resource=models.ArmResourceIdentifierResource( + location="eastus", + properties=models.ArmResourceIdentifierResourceProperties( + simple_arm_id=SIMPLE_ARM_ID, + arm_id_with_type=ARM_ID_WITH_TYPE, + arm_id_with_type_and_scope=ARM_ID_WITH_TYPE_AND_SCOPE, + arm_id_with_all_scopes=ARM_ID_WITH_ALL_SCOPES, + ), + ), + ) + assert result.location == "eastus" + assert result.properties.provisioning_state == "Succeeded" + assert result.properties.simple_arm_id == SIMPLE_ARM_ID + assert result.properties.arm_id_with_type == ARM_ID_WITH_TYPE + assert result.properties.arm_id_with_type_and_scope == ARM_ID_WITH_TYPE_AND_SCOPE + assert result.properties.arm_id_with_all_scopes == ARM_ID_WITH_ALL_SCOPES diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_arm_managementgroup.py b/packages/http-client-python/tests/mock_api/azure/test_azure_arm_managementgroup.py new file mode 100644 index 00000000000..3a5bf3b4fa3 --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_arm_managementgroup.py @@ -0,0 +1,71 @@ +# ------------------------------------------------------------------------- +# 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.resourcemanager.managementgroup import ManagementGroupClient +from azure.resourcemanager.managementgroup import models + +MANAGEMENT_GROUP_ID = "test-mg" +RESOURCE_NAME = "resource" + + +@pytest.fixture +def client(credential, authentication_policy): + with ManagementGroupClient( + credential, "http://localhost:3000", authentication_policy=authentication_policy + ) as client: + yield client + + +def test_management_group_child_resources_get(client): + result = client.management_group_child_resources.get( + management_group_id=MANAGEMENT_GROUP_ID, management_group_child_resource_name=RESOURCE_NAME + ) + assert result.name == RESOURCE_NAME + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + + +def test_management_group_child_resources_create_or_update(client): + result = client.management_group_child_resources.begin_create_or_update( + management_group_id=MANAGEMENT_GROUP_ID, + management_group_child_resource_name=RESOURCE_NAME, + resource=models.ManagementGroupChildResource( + properties=models.ManagementGroupChildResourceProperties(description="valid") + ), + polling_interval=0, + ).result() + assert result.name == RESOURCE_NAME + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + + +def test_management_group_child_resources_update(client): + result = client.management_group_child_resources.update( + management_group_id=MANAGEMENT_GROUP_ID, + management_group_child_resource_name=RESOURCE_NAME, + properties=models.ManagementGroupChildResource( + properties=models.ManagementGroupChildResourceProperties(description="valid2") + ), + ) + assert result.name == RESOURCE_NAME + assert result.properties.description == "valid2" + assert result.properties.provisioning_state == "Succeeded" + + +def test_management_group_child_resources_delete(client): + client.management_group_child_resources.delete( + management_group_id=MANAGEMENT_GROUP_ID, management_group_child_resource_name=RESOURCE_NAME + ) + + +def test_management_group_child_resources_list_by_management_group(client): + result = list( + client.management_group_child_resources.list_by_management_group(management_group_id=MANAGEMENT_GROUP_ID) + ) + assert len(result) == 1 + assert result[0].name == RESOURCE_NAME + assert result[0].properties.description == "valid" + assert result[0].properties.provisioning_state == "Succeeded" diff --git a/packages/http-client-python/tests/mock_api/azure/test_service_multiple_services.py b/packages/http-client-python/tests/mock_api/azure/test_service_multiple_services.py new file mode 100644 index 00000000000..1949fba529c --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/test_service_multiple_services.py @@ -0,0 +1,36 @@ +# ------------------------------------------------------------------------- +# 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 service.multipleservices.servicea import ServiceAClient +from service.multipleservices.serviceb import ServiceBClient + + +@pytest.fixture +def client_a(): + with ServiceAClient() as client: + yield client + + +@pytest.fixture +def client_b(): + with ServiceBClient() as client: + yield client + + +def test_service_a_op(client_a: ServiceAClient): + client_a.operations.op_a() + + +def test_service_a_sub_namespace_op(client_a: ServiceAClient): + client_a.sub_namespace.sub_op_a() + + +def test_service_b_op(client_b: ServiceBClient): + client_b.operations.op_b() + + +def test_service_b_sub_namespace_op(client_b: ServiceBClient): + client_b.sub_namespace.sub_op_b()