Skip to content

Commit

Permalink
test: add test cases for command examples (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackchoey authored May 28, 2024
1 parent 69ff9f8 commit a5d7113
Show file tree
Hide file tree
Showing 60 changed files with 5,789 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ExportSpecification(AAZCommand):
"""Exports the API specification.
:example: Export Specification
az apic api version definition export-specification -g api-center-test -s contosoeuap --api-id echo-api --version-id 2023-01-01 --definition-id default
az apic api definition export-specification -g api-center-test -s contosoeuap --api-id echo-api --version-id 2023-01-01 --definition-id default --file-name filename.json
"""

_aaz_info = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Create(AAZCommand):
"""Create a new API version or update an existing API version.
:example: Create API version
az apic api version create -g api-center-test -s contosoeuap --api-id echo-api --version-id 2023-01-01 --title "2023-01-01"
az apic api version create -g api-center-test -s contosoeuap --api-id echo-api --version-id 2023-01-01 --title "2023-01-01" --lifecycle-stage production
"""

_aaz_info = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
interactions:
- request:
body: '{"properties": {"kind": "rest", "title": "Echo API"}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- apic api create
Connection:
- keep-alive
Content-Length:
- '53'
Content-Type:
- application/json
ParameterSetName:
- -g -s --api-id --title --type
User-Agent:
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/cli000003?api-version=2024-03-01
response:
body:
string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis","properties":{"title":"Echo
API","kind":"rest","externalDocumentation":[],"contacts":[],"customProperties":{}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/cli000003","name":"cli000003","systemData":{"createdAt":"2024-05-24T07:50:59.3799269Z","lastModifiedAt":"2024-05-24T07:50:59.3799259Z"}}'
headers:
api-supported-versions:
- 2023-07-01-preview, 2024-03-01, 2024-03-15-preview
cache-control:
- no-cache
content-length:
- '464'
content-type:
- application/json; charset=utf-8
date:
- Fri, 24 May 2024 07:50:59 GMT
etag:
- 3000bd3e-0000-0100-0000-665046e30000
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
vary:
- Accept-Encoding
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
x-msedge-ref:
- 'Ref A: 73675F9FA6514297956723A9D39BBF2E Ref B: MAA201060516009 Ref C: 2024-05-24T07:50:57Z'
x-powered-by:
- ASP.NET
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
interactions:
- request:
body: '{"properties": {"title": "OpenAPI"}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- apic api definition create
Connection:
- keep-alive
Content-Length:
- '36'
Content-Type:
- application/json
ParameterSetName:
- -g -s --api-id --version-id --definition-id --title
User-Agent:
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.19045-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/clitest000003/versions/clitest000004/definitions/cli000005?api-version=2024-03-01
response:
body:
string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions/definitions","properties":{"title":"OpenAPI"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/clitest000003/versions/clitest000004/definitions/cli000005","name":"cli000005","systemData":{"createdAt":"2024-05-27T02:27:49.1479171Z","lastModifiedAt":"2024-05-27T02:27:49.1479161Z"}}'
headers:
api-supported-versions:
- 2023-07-01-preview, 2024-03-01, 2024-03-15-preview
cache-control:
- no-cache
content-length:
- '456'
content-type:
- application/json; charset=utf-8
date:
- Mon, 27 May 2024 02:27:48 GMT
etag:
- 52001a88-0000-0100-0000-6653efa50000
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
vary:
- Accept-Encoding
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-global-writes:
- '2999'
x-ms-ratelimit-remaining-subscription-writes:
- '199'
x-msedge-ref:
- 'Ref A: C892758C6B5D4E91A3A952F40191D328 Ref B: MAA201060515039 Ref C: 2024-05-27T02:27:48Z'
x-powered-by:
- ASP.NET
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
interactions:
- request:
body: '{"properties": {"lifecycleStage": "production", "title": "2023-01-01"}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- apic api version create
Connection:
- keep-alive
Content-Length:
- '71'
Content-Type:
- application/json
ParameterSetName:
- -g -s --api-id --version-id --title --lifecycle-stage
User-Agent:
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.19045-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/clitest000003/versions/cli000004?api-version=2024-03-01
response:
body:
string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/versions","properties":{"title":"2023-01-01","lifecycleStage":"production"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/clitest000003/versions/cli000004","name":"cli000004","systemData":{"createdAt":"2024-05-27T03:00:25.3664586Z","lastModifiedAt":"2024-05-27T03:00:25.3664577Z"}}'
headers:
api-supported-versions:
- 2023-07-01-preview, 2024-03-01, 2024-03-15-preview
cache-control:
- no-cache
content-length:
- '451'
content-type:
- application/json; charset=utf-8
date:
- Mon, 27 May 2024 03:00:25 GMT
etag:
- 9b013724-0000-0100-0000-6653f7490000
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
vary:
- Accept-Encoding
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-global-writes:
- '2999'
x-ms-ratelimit-remaining-subscription-writes:
- '199'
x-msedge-ref:
- 'Ref A: 2EE67EE9E32D48F480C42CDA128D284F Ref B: MAA201060515031 Ref C: 2024-05-27T03:00:24Z'
x-powered-by:
- ASP.NET
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
interactions:
- request:
body: '{"properties": {"customProperties": {"clitest000003": true}, "kind": "rest",
"title": "Echo API"}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- apic api create
Connection:
- keep-alive
Content-Length:
- '98'
Content-Type:
- application/json
ParameterSetName:
- -g -s --api-id --title --type --custom-properties
User-Agent:
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/cli000004?api-version=2024-03-01
response:
body:
string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis","properties":{"title":"Echo
API","kind":"rest","externalDocumentation":[],"contacts":[],"customProperties":{"clitest000003":true}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/cli000004","name":"cli000004","systemData":{"createdAt":"2024-05-24T07:51:19.9191143Z","lastModifiedAt":"2024-05-24T07:51:19.9190948Z"}}'
headers:
api-supported-versions:
- 2023-07-01-preview, 2024-03-01, 2024-03-15-preview
cache-control:
- no-cache
content-length:
- '484'
content-type:
- application/json; charset=utf-8
date:
- Fri, 24 May 2024 07:51:19 GMT
etag:
- 3000c940-0000-0100-0000-665046f70000
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
vary:
- Accept-Encoding
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1198'
x-msedge-ref:
- 'Ref A: 9BC575065296493C944EFF1CBFEA5ECF Ref B: MAA201060514033 Ref C: 2024-05-24T07:51:18Z'
x-powered-by:
- ASP.NET
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
interactions:
- request:
body: '{"properties": {"definitionId": "/workspaces/default/apis/clitest000004/versions/clitest000005/definitions/clitest000006",
"description": "Public cloud production deployment.", "environmentId": "/workspaces/default/environments/clitest000003",
"server": {"runtimeUri": ["https://example.com"]}, "title": "Production deployment"}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- apic api deployment create
Connection:
- keep-alive
Content-Length:
- '329'
Content-Type:
- application/json
ParameterSetName:
- -g -s --deployment-id --title --description --api-id --environment-id --definition-id
--server
User-Agent:
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.19045-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/clitest000004/deployments/mock-deployment?api-version=2024-03-01
response:
body:
string: '{"type":"Microsoft.ApiCenter/services/workspaces/apis/deployments","properties":{"title":"Production
deployment","description":"Public cloud production deployment.","environmentId":"/workspaces/default/environments/clitest000003","definitionId":"/workspaces/default/apis/clitest000004/versions/clitest000005/definitions/clitest000006","server":{"runtimeUri":["https://example.com"]},"customProperties":{},"recommended":false},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/clitest000004/deployments/cli000007","name":"cli000007","systemData":{"createdAt":"2024-05-27T02:27:55.2453007Z","lastModifiedAt":"2024-05-27T02:27:55.2452997Z"}}'
headers:
api-supported-versions:
- 2023-07-01-preview, 2024-03-01, 2024-03-15-preview
cache-control:
- no-cache
content-length:
- '750'
content-type:
- application/json; charset=utf-8
date:
- Mon, 27 May 2024 02:27:55 GMT
etag:
- 3a01e800-0000-0100-0000-6653efab0000
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
vary:
- Accept-Encoding
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-global-writes:
- '2999'
x-ms-ratelimit-remaining-subscription-writes:
- '199'
x-msedge-ref:
- 'Ref A: 1BC0114248E04A5D83F10D5D319640C6 Ref B: MAA201060516049 Ref C: 2024-05-27T02:27:54Z'
x-powered-by:
- ASP.NET
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
interactions:
- request:
body: '{"properties": {"kind": "development", "title": "Public cloud"}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- apic environment create
Connection:
- keep-alive
Content-Length:
- '64'
Content-Type:
- application/json
ParameterSetName:
- -g -s --environment-id --title --type
User-Agent:
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/environments/cli000003?api-version=2024-03-01
response:
body:
string: '{"type":"Microsoft.ApiCenter/services/workspaces/environments","properties":{"title":"Public
cloud","kind":"development","customProperties":{}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/environments/cli000003","name":"cli000003","systemData":{"createdAt":"2024-05-24T07:51:06.6386454Z"}}'
headers:
api-supported-versions:
- 2023-07-01-preview, 2024-03-01, 2024-03-15-preview
cache-control:
- no-cache
content-length:
- '402'
content-type:
- application/json; charset=utf-8
date:
- Fri, 24 May 2024 07:51:05 GMT
etag:
- 2500f1d8-0000-0100-0000-665046ea0000
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
vary:
- Accept-Encoding
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1198'
x-msedge-ref:
- 'Ref A: 177FE32340EA4BFBA93D2D1E97609CEB Ref B: MAA201060515011 Ref C: 2024-05-24T07:51:05Z'
x-powered-by:
- ASP.NET
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit a5d7113

Please sign in to comment.