Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Commit

Permalink
Reopen Tests ARM, test case for listing available operations
Browse files Browse the repository at this point in the history
  • Loading branch information
v-hongli1 committed Oct 28, 2024
1 parent b359a78 commit a297135
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-singers-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@azure-tools/cadl-ranch-specs": patch
---

Tests ARM, test case for listing available operations
29 changes: 29 additions & 0 deletions packages/cadl-ranch-specs/cadl-ranch-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,35 @@ Expected response body:
}
```

### Azure_ResourceManager_Resources_ListAvailableOperations

- Endpoint: `get https://management.azure.com`

Resource GET operation.
Expected path: /providers/Azure.ResourceManager.Resources/operations
Expected query parameter: api-version=2023-12-01-preview

Expected response body:

```json
{
"value": [
{
"name": "Microsoft.Compute/virtualMachines/write",
"isDataAction": false,
"display": {
"provider": "Microsoft Compute",
"resource": "Virtual Machines",
"operation": "Create or Update Virtual Machine.",
"description": "Add or modify virtual machines."
},
"origin": "user,system",
"actionType": "Internal"
}
]
}
```

### Azure_ResourceManager_Resources_Nested_createOrReplace

- Endpoint: `put https://management.azure.com`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,29 @@ union ProvisioningState {
Deleting: "Deleting",
Accepted: "Accepted",
}

@scenario("ListAvailableOperations")
@scenarioDoc("""
Resource GET operation.
Expected path: /providers/Azure.ResourceManager.Resources/operations
Expected query parameter: api-version=2023-12-01-preview
Expected response body:
```json
{
"value": [{
"name": "Microsoft.Compute/virtualMachines/write",
"isDataAction": false,
"display": {
"provider": "Microsoft Compute",
"resource": "Virtual Machines",
"operation": "Create or Update Virtual Machine.",
"description": "Add or modify virtual machines."
},
"origin": "user,system",
"actionType": "Internal"
}]
}
```
""")
interface Operations extends Azure.ResourceManager.Operations {}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,37 @@ const validSingletonResource = {
},
};

const validAvailableOperations = {
name: "Microsoft.Compute/virtualMachines/write",
isDataAction: false,
display: {
provider: "Microsoft Compute",
resource: "Virtual Machines",
operation: "Create or Update Virtual Machine.",
description: "Add or modify virtual machines.",
},
origin: "user,system",
actionType: "Internal",
};

// operation list
Scenarios.Azure_ResourceManager_Resources_ListAvailableOperations = passOnSuccess({
uri: "/providers/Azure.ResourceManager.Resources/operations",
method: "get",
request: {
params: {
"api-version": "2023-12-01-preview",
},
},
response: {
status: 200,
body: json({
value: [validAvailableOperations],
}),
},
kind: "MockApiDefinition",
});

// singleton tracked resource
Scenarios.Azure_ResourceManager_Resources_Singleton_getByResourceGroup = passOnSuccess({
uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default",
Expand Down

0 comments on commit a297135

Please sign in to comment.