Skip to content

Commit

Permalink
tests for get file workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
grhuangmsft committed Jan 30, 2024
1 parent 1d8bed2 commit 41e373b
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/Support/Support.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ directive:
- FileSize
- NumberOfChunks
- where:
verb: New
subject: FileWorkspacesNoSubscription
parameter-name: FileWorkspaceName
set:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ File Workspace Name
```yaml
Type: System.String
Parameter Sets: Get
Aliases:
Aliases: Name

Required: True
Position: Named
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"Get-AzSupportFileWorkspace+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-d4adfb8c-f15c-48de-a0b0-8da419bfe51d?api-version=2022-09-01-preview+1": {
"Request": {
"Method": "GET",
"RequestUri": "https://management.azure.com/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-d4adfb8c-f15c-48de-a0b0-8da419bfe51d?api-version=2022-09-01-preview",
"Content": null,
"isContentBase64": false,
"Headers": {
"x-ms-unique-id": [ "3" ],
"x-ms-client-request-id": [ "041c6579-0787-44ad-aaa1-ae473436f07b" ],
"CommandName": [ "Get-AzSupportFileWorkspace" ],
"FullCommandName": [ "Get-AzSupportFileWorkspace_Get" ],
"ParameterSetName": [ "__AllParameterSets" ],
"User-Agent": [ "AzurePowershell/v11.2.0", "PSVersion/v7.3.11", "Az.Support/0.1.0" ],
"Authorization": [ "[Filtered]" ]
},
"ContentHeaders": {
}
},
"Response": {
"StatusCode": 200,
"Headers": {
"Cache-Control": [ "no-cache" ],
"Pragma": [ "no-cache" ],
"X-Content-Type-Options": [ "nosniff" ],
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
"Server": [ "Kestrel" ],
"x-ms-ratelimit-remaining-subscription-reads": [ "11999" ],
"x-ms-request-id": [ "b752c627-0706-4e1a-bb95-db1b17775e08" ],
"x-ms-correlation-request-id": [ "b752c627-0706-4e1a-bb95-db1b17775e08" ],
"x-ms-routing-request-id": [ "EASTUS:20240130T153256Z:b752c627-0706-4e1a-bb95-db1b17775e08" ],
"Date": [ "Tue, 30 Jan 2024 15:32:56 GMT" ]
},
"ContentHeaders": {
"Content-Length": [ "334" ],
"Content-Type": [ "application/json; charset=utf-8" ],
"Expires": [ "-1" ]
},
"Content": "{\"id\":\"/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-d4adfb8c-f15c-48de-a0b0-8da419bfe51d\",\"name\":\"test-ps-d4adfb8c-f15c-48de-a0b0-8da419bfe51d\",\"type\":\"Microsoft.Support/fileWorkspaces\",\"properties\":{\"expirationTime\":\"2024-01-31T15:32:53Z\",\"createdOn\":\"2024-01-30T15:32:53Z\"}}",
"isContentBase64": false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFileWorkspace'))
}

Describe 'Get-AzSupportFileWorkspace' {
It 'Get' -skip {
{ throw [System.NotImplementedException] } | Should -Not -Throw
It 'Get' {
$fileWorkspace = Get-AzSupportFileWorkspace -Name $env.FileWorkspaceNameSubscription
$fileWorkspace.Name | Should -Be $env.FileWorkspaceNameSubscription
}

It 'GetViaIdentity' -skip {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"Get-AzSupportFileWorkspacesNoSubscription+[NoContext]+Get+$GET+https://management.azure.com/providers/Microsoft.Support/fileWorkspaces/test-ps-43ad6585-c0ac-4a13-8d0e-bb633b8b1db3?api-version=2022-09-01-preview+1": {
"Request": {
"Method": "GET",
"RequestUri": "https://management.azure.com/providers/Microsoft.Support/fileWorkspaces/test-ps-43ad6585-c0ac-4a13-8d0e-bb633b8b1db3?api-version=2022-09-01-preview",
"Content": null,
"isContentBase64": false,
"Headers": {
"x-ms-unique-id": [ "4" ],
"x-ms-client-request-id": [ "7e321a52-1564-4b97-a1c2-a57079ec53cc" ],
"CommandName": [ "Get-AzSupportFileWorkspacesNoSubscription" ],
"FullCommandName": [ "Get-AzSupportFileWorkspacesNoSubscription_Get" ],
"ParameterSetName": [ "__AllParameterSets" ],
"User-Agent": [ "AzurePowershell/v11.2.0", "PSVersion/v7.3.11", "Az.Support/0.1.0" ],
"Authorization": [ "[Filtered]" ]
},
"ContentHeaders": {
}
},
"Response": {
"StatusCode": 200,
"Headers": {
"Cache-Control": [ "no-cache" ],
"Pragma": [ "no-cache" ],
"X-Content-Type-Options": [ "nosniff" ],
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
"Server": [ "Kestrel" ],
"x-ms-ratelimit-remaining-tenant-reads": [ "11999" ],
"x-ms-request-id": [ "27f3281f-f92e-487d-bc46-0a21387d2502" ],
"x-ms-correlation-request-id": [ "27f3281f-f92e-487d-bc46-0a21387d2502" ],
"x-ms-routing-request-id": [ "EASTUS:20240130T153259Z:27f3281f-f92e-487d-bc46-0a21387d2502" ],
"Date": [ "Tue, 30 Jan 2024 15:32:58 GMT" ]
},
"ContentHeaders": {
"Content-Length": [ "283" ],
"Content-Type": [ "application/json; charset=utf-8" ],
"Expires": [ "-1" ]
},
"Content": "{\"id\":\"/providers/Microsoft.Support/fileWorkspaces/test-ps-43ad6585-c0ac-4a13-8d0e-bb633b8b1db3\",\"name\":\"test-ps-43ad6585-c0ac-4a13-8d0e-bb633b8b1db3\",\"type\":\"Microsoft.Support/fileWorkspaces\",\"properties\":{\"expirationTime\":\"2024-01-31T15:32:54Z\",\"createdOn\":\"2024-01-30T15:32:54Z\"}}",
"isContentBase64": false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFileWorkspacesNo
}

Describe 'Get-AzSupportFileWorkspacesNoSubscription' {
It 'Get' -skip {
{ throw [System.NotImplementedException] } | Should -Not -Throw
It 'Get' {
$fileWorkspace = Get-AzSupportFileWorkspacesNoSubscription -Name $env.FileWorkspaceNameNoSubscription
$fileWorkspace.Name | Should -Be $env.FileWorkspaceNameNoSubscription
}

It 'GetViaIdentity' -skip {
Expand Down
6 changes: 4 additions & 2 deletions src/Support/Support.Autorest/test/env.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"BillingProblemClassificationId": "d0f16bf7-e011-3f3b-1c26-3147f84e0896",
"BillingServiceId": "517f2da6-78fd-0498-4e22-ad26996b1dfc",
"SubscriptionId": "4df09db9-7a7e-450b-8f88-00fb97c277bd",
"Tenant": "d71d46f6-114f-4d2a-81c9-8fc86ba8801c",
"BillingProblemClassificationId": "d0f16bf7-e011-3f3b-1c26-3147f84e0896"
"FileWorkspaceNameNoSubscription": "test-ps-43ad6585-c0ac-4a13-8d0e-bb633b8b1db3",
"SubscriptionId": "4df09db9-7a7e-450b-8f88-00fb97c277bd",
"FileWorkspaceNameSubscription": "test-ps-d4adfb8c-f15c-48de-a0b0-8da419bfe51d"
}
7 changes: 7 additions & 0 deletions src/Support/Support.Autorest/test/utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ function setupEnv() {
$env.BillingServiceId = "517f2da6-78fd-0498-4e22-ad26996b1dfc"
$env.BillingProblemClassificationId = "d0f16bf7-e011-3f3b-1c26-3147f84e0896"
# For any resources you created for test, you should add it to $env here.

$env.FileWorkspaceNameSubscription = "test-ps-$(New-Guid)"
$env.FileWorkspaceNameNoSubscription = "test-ps-$(New-Guid)"

New-AzSupportFileWorkspace -Name $env.FileWorkspaceNameSubscription
New-AzSupportFileWorkspacesNoSubscription -Name $env.FileWorkspaceNameNoSubscription

$envFile = 'env.json'
if ($TestMode -eq 'live') {
$envFile = 'localEnv.json'
Expand Down

0 comments on commit 41e373b

Please sign in to comment.