Skip to content

Commit 683579a

Browse files
committed
tests for get file
1 parent 5332d08 commit 683579a

10 files changed

+210
-22
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"Get-AzSupportFile+[NoContext]+List+$GET+https://management.azure.com/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-0c3b99a5-4267-4823-bac3-9ce954258d71/files?api-version=2022-09-01-preview+1": {
3+
"Request": {
4+
"Method": "GET",
5+
"RequestUri": "https://management.azure.com/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-0c3b99a5-4267-4823-bac3-9ce954258d71/files?api-version=2022-09-01-preview",
6+
"Content": null,
7+
"isContentBase64": false,
8+
"Headers": {
9+
"x-ms-unique-id": [ "7" ],
10+
"x-ms-client-request-id": [ "4b89a6cc-cce6-4c22-a7cf-ec36148bd130" ],
11+
"CommandName": [ "Get-AzSupportFile" ],
12+
"FullCommandName": [ "Get-AzSupportFile_List" ],
13+
"ParameterSetName": [ "__AllParameterSets" ],
14+
"User-Agent": [ "AzurePowershell/v11.2.0", "PSVersion/v7.3.11", "Az.Support/0.1.0" ],
15+
"Authorization": [ "[Filtered]" ]
16+
},
17+
"ContentHeaders": {
18+
}
19+
},
20+
"Response": {
21+
"StatusCode": 200,
22+
"Headers": {
23+
"Cache-Control": [ "no-cache" ],
24+
"Pragma": [ "no-cache" ],
25+
"X-Content-Type-Options": [ "nosniff" ],
26+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
27+
"Server": [ "Kestrel" ],
28+
"x-ms-ratelimit-remaining-subscription-reads": [ "11999" ],
29+
"x-ms-request-id": [ "c0d7f0f6-5b90-475d-99ed-0bcda9afd749" ],
30+
"x-ms-correlation-request-id": [ "c0d7f0f6-5b90-475d-99ed-0bcda9afd749" ],
31+
"x-ms-routing-request-id": [ "EASTUS:20240131T204836Z:c0d7f0f6-5b90-475d-99ed-0bcda9afd749" ],
32+
"Date": [ "Wed, 31 Jan 2024 20:48:36 GMT" ]
33+
},
34+
"ContentHeaders": {
35+
"Content-Length": [ "324" ],
36+
"Content-Type": [ "application/json; charset=utf-8" ],
37+
"Expires": [ "-1" ]
38+
},
39+
"Content": "{\"value\":[{\"id\":\"/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-0c3b99a5-4267-4823-bac3-9ce954258d71/files/test2.txt\",\"name\":\"test2.txt\",\"type\":\"Microsoft.Support/files\",\"properties\":{\"createdOn\":\"2024-01-31T20:48:23Z\",\"fileSize\":4,\"chunkSize\":4,\"numberOfChunks\":1}}]}",
40+
"isContentBase64": false
41+
}
42+
},
43+
"Get-AzSupportFile+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-0c3b99a5-4267-4823-bac3-9ce954258d71/files/test2.txt?api-version=2022-09-01-preview+1": {
44+
"Request": {
45+
"Method": "GET",
46+
"RequestUri": "https://management.azure.com/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-0c3b99a5-4267-4823-bac3-9ce954258d71/files/test2.txt?api-version=2022-09-01-preview",
47+
"Content": null,
48+
"isContentBase64": false,
49+
"Headers": {
50+
"x-ms-unique-id": [ "8" ],
51+
"x-ms-client-request-id": [ "38fb9ad8-55b6-4dc2-a2f6-d9632cfaa3f1" ],
52+
"CommandName": [ "Get-AzSupportFile" ],
53+
"FullCommandName": [ "Get-AzSupportFile_Get" ],
54+
"ParameterSetName": [ "__AllParameterSets" ],
55+
"User-Agent": [ "AzurePowershell/v11.2.0", "PSVersion/v7.3.11", "Az.Support/0.1.0" ],
56+
"Authorization": [ "[Filtered]" ]
57+
},
58+
"ContentHeaders": {
59+
}
60+
},
61+
"Response": {
62+
"StatusCode": 200,
63+
"Headers": {
64+
"Cache-Control": [ "no-cache" ],
65+
"Pragma": [ "no-cache" ],
66+
"X-Content-Type-Options": [ "nosniff" ],
67+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
68+
"Server": [ "Kestrel" ],
69+
"x-ms-ratelimit-remaining-subscription-reads": [ "11998" ],
70+
"x-ms-request-id": [ "3400becf-1644-4257-8530-0f22159c8371" ],
71+
"x-ms-correlation-request-id": [ "3400becf-1644-4257-8530-0f22159c8371" ],
72+
"x-ms-routing-request-id": [ "EASTUS:20240131T204839Z:3400becf-1644-4257-8530-0f22159c8371" ],
73+
"Date": [ "Wed, 31 Jan 2024 20:48:38 GMT" ]
74+
},
75+
"ContentHeaders": {
76+
"Content-Length": [ "312" ],
77+
"Content-Type": [ "application/json; charset=utf-8" ],
78+
"Expires": [ "-1" ]
79+
},
80+
"Content": "{\"id\":\"/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-0c3b99a5-4267-4823-bac3-9ce954258d71/files/test2.txt\",\"name\":\"test2.txt\",\"type\":\"Microsoft.Support/files\",\"properties\":{\"createdOn\":\"2024-01-31T20:48:23Z\",\"fileSize\":4,\"chunkSize\":4,\"numberOfChunks\":1}}",
81+
"isContentBase64": false
82+
}
83+
}
84+
}

src/Support/Support.Autorest/test/Get-AzSupportFile.Tests.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFile'))
1515
}
1616

1717
Describe 'Get-AzSupportFile' {
18-
It 'List' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'List' {
19+
$files = Get-AzSupportFile -WorkspaceName $env.FileWorkspaceNameSubscription
20+
$files | Should -Not -BeNullOrEmpty
21+
$files.Count | Should -BeGreaterOrEqual 1
2022
}
2123

2224
It 'GetViaIdentityFileWorkspace' -skip {
2325
{ throw [System.NotImplementedException] } | Should -Not -Throw
2426
}
2527

26-
It 'Get' -skip {
27-
{ throw [System.NotImplementedException] } | Should -Not -Throw
28+
It 'Get' {
29+
$file = Get-AzSupportFile -Name "test2.txt" -WorkspaceName $env.FileWorkspaceNameSubscription
30+
$file | Should -Not -BeNullOrEmpty
31+
$file.Name | Should -Be "test2.txt"
2832
}
2933

3034
It 'GetViaIdentity' -skip {
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"Get-AzSupportFilesNoSubscription+[NoContext]+List+$GET+https://management.azure.com/providers/Microsoft.Support/fileWorkspaces/test-ps-c3365113-f08e-4317-936c-3d948a9dc191/files?api-version=2022-09-01-preview+1": {
3+
"Request": {
4+
"Method": "GET",
5+
"RequestUri": "https://management.azure.com/providers/Microsoft.Support/fileWorkspaces/test-ps-c3365113-f08e-4317-936c-3d948a9dc191/files?api-version=2022-09-01-preview",
6+
"Content": null,
7+
"isContentBase64": false,
8+
"Headers": {
9+
"x-ms-unique-id": [ "7" ],
10+
"x-ms-client-request-id": [ "8b7d8112-3549-4b6f-b5bb-6e37f5025d6e" ],
11+
"CommandName": [ "Get-AzSupportFilesNoSubscription" ],
12+
"FullCommandName": [ "Get-AzSupportFilesNoSubscription_List" ],
13+
"ParameterSetName": [ "__AllParameterSets" ],
14+
"User-Agent": [ "AzurePowershell/v11.2.0", "PSVersion/v7.3.11", "Az.Support/0.1.0" ],
15+
"Authorization": [ "[Filtered]" ]
16+
},
17+
"ContentHeaders": {
18+
}
19+
},
20+
"Response": {
21+
"StatusCode": 200,
22+
"Headers": {
23+
"Cache-Control": [ "no-cache" ],
24+
"Pragma": [ "no-cache" ],
25+
"X-Content-Type-Options": [ "nosniff" ],
26+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
27+
"Server": [ "Kestrel" ],
28+
"x-ms-ratelimit-remaining-tenant-reads": [ "11999" ],
29+
"x-ms-request-id": [ "5492f034-1f75-490e-9bbd-cd2cf6206655" ],
30+
"x-ms-correlation-request-id": [ "5492f034-1f75-490e-9bbd-cd2cf6206655" ],
31+
"x-ms-routing-request-id": [ "EASTUS:20240131T205029Z:5492f034-1f75-490e-9bbd-cd2cf6206655" ],
32+
"Date": [ "Wed, 31 Jan 2024 20:50:29 GMT" ]
33+
},
34+
"ContentHeaders": {
35+
"Content-Length": [ "273" ],
36+
"Content-Type": [ "application/json; charset=utf-8" ],
37+
"Expires": [ "-1" ]
38+
},
39+
"Content": "{\"value\":[{\"id\":\"/providers/Microsoft.Support/fileWorkspaces/test-ps-c3365113-f08e-4317-936c-3d948a9dc191/files/test2.txt\",\"name\":\"test2.txt\",\"type\":\"Microsoft.Support/files\",\"properties\":{\"createdOn\":\"2024-01-31T20:50:22Z\",\"fileSize\":4,\"chunkSize\":4,\"numberOfChunks\":1}}]}",
40+
"isContentBase64": false
41+
}
42+
},
43+
"Get-AzSupportFilesNoSubscription+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-1c0f34c3-a77f-48f8-92ed-4bc40297b575/files/test2.txt?api-version=2022-09-01-preview+1": {
44+
"Request": {
45+
"Method": "GET",
46+
"RequestUri": "https://management.azure.com/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-1c0f34c3-a77f-48f8-92ed-4bc40297b575/files/test2.txt?api-version=2022-09-01-preview",
47+
"Content": null,
48+
"isContentBase64": false,
49+
"Headers": {
50+
"x-ms-unique-id": [ "8" ],
51+
"x-ms-client-request-id": [ "cf38d6d8-65c4-4d14-89a8-9873739fa276" ],
52+
"CommandName": [ "Get-AzSupportFile" ],
53+
"FullCommandName": [ "Get-AzSupportFile_Get" ],
54+
"ParameterSetName": [ "__AllParameterSets" ],
55+
"User-Agent": [ "AzurePowershell/v11.2.0", "PSVersion/v7.3.11", "Az.Support/0.1.0" ],
56+
"Authorization": [ "[Filtered]" ]
57+
},
58+
"ContentHeaders": {
59+
}
60+
},
61+
"Response": {
62+
"StatusCode": 200,
63+
"Headers": {
64+
"Cache-Control": [ "no-cache" ],
65+
"Pragma": [ "no-cache" ],
66+
"X-Content-Type-Options": [ "nosniff" ],
67+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
68+
"Server": [ "Kestrel" ],
69+
"x-ms-ratelimit-remaining-subscription-reads": [ "11999" ],
70+
"x-ms-request-id": [ "cd7c5450-a2b1-4cf5-ae38-5d66e02e3c73" ],
71+
"x-ms-correlation-request-id": [ "cd7c5450-a2b1-4cf5-ae38-5d66e02e3c73" ],
72+
"x-ms-routing-request-id": [ "EASTUS:20240131T205032Z:cd7c5450-a2b1-4cf5-ae38-5d66e02e3c73" ],
73+
"Date": [ "Wed, 31 Jan 2024 20:50:32 GMT" ]
74+
},
75+
"ContentHeaders": {
76+
"Content-Length": [ "312" ],
77+
"Content-Type": [ "application/json; charset=utf-8" ],
78+
"Expires": [ "-1" ]
79+
},
80+
"Content": "{\"id\":\"/subscriptions/4df09db9-7a7e-450b-8f88-00fb97c277bd/providers/Microsoft.Support/fileWorkspaces/test-ps-1c0f34c3-a77f-48f8-92ed-4bc40297b575/files/test2.txt\",\"name\":\"test2.txt\",\"type\":\"Microsoft.Support/files\",\"properties\":{\"createdOn\":\"2024-01-31T20:50:15Z\",\"fileSize\":4,\"chunkSize\":4,\"numberOfChunks\":1}}",
81+
"isContentBase64": false
82+
}
83+
}
84+
}

src/Support/Support.Autorest/test/Get-AzSupportFilesNoSubscription.Tests.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFilesNoSubscript
1515
}
1616

1717
Describe 'Get-AzSupportFilesNoSubscription' {
18-
It 'List' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'List' {
19+
$files = Get-AzSupportFilesNoSubscription -WorkspaceName $env.FileWorkspaceNameNoSubscription
20+
$files | Should -Not -BeNullOrEmpty
21+
$files.Count | Should -BeGreaterOrEqual 1
2022
}
2123

2224
It 'GetViaIdentityFileWorkspace' -skip {
2325
{ throw [System.NotImplementedException] } | Should -Not -Throw
2426
}
2527

26-
It 'Get' -skip {
27-
{ throw [System.NotImplementedException] } | Should -Not -Throw
28+
It 'Get' {
29+
$file = Get-AzSupportFile -Name "test2.txt" -WorkspaceName $env.FileWorkspaceNameSubscription
30+
$file | Should -Not -BeNullOrEmpty
31+
$file.Name | Should -Be "test2.txt"
2832
}
2933

3034
It 'GetViaIdentity' -skip {

src/Support/Support.Autorest/test/New-AzSupportFileAndUpload.Tests.ps1

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzSupportFileAndUpload'))
1616

1717
Describe 'New-AzSupportFileAndUpload' {
1818
It 'CreateExpanded' {
19-
Write-Host "current path: " + $currentPath
20-
Write-Host "ps script root: " + $PSScriptRoot
2119
$testFilePath = Join-Path $PSScriptRoot files test.txt
22-
Write-Host "test file path: " + $testFilePath
2320
$file = New-AzSupportFileAndUpload -WorkspaceName $env.FileWorkspaceNameSubscription -FilePath $testFilePath
2421
$file.Name | Should -Be "test.txt"
2522
}

src/Support/Support.Autorest/test/Test-AzSupportTicketNameAvailability.Tests.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ if(($null -eq $TestName) -or ($TestName -contains 'Test-AzSupportTicketNameAvail
1515
}
1616

1717
Describe 'Test-AzSupportTicketNameAvailability' {
18-
It 'CheckExpanded' {
19-
$result = Test-AzSupportTicketNameAvailability -Name "test-ps-$(New-Guid)" -Type "Microsoft.Support/supportTickets"-SubscriptionId $env.SubscriptionId
20-
$result.NameAvailable | Should -Be $true
18+
It 'CheckExpandedSupportTicket' {
19+
$supportTicketResult = Test-AzSupportTicketNameAvailability -Name "test-ps-$(New-Guid)" -Type "Microsoft.Support/supportTickets"-SubscriptionId $env.SubscriptionId
20+
$supportTicketResult.NameAvailable | Should -Be $true
21+
}
22+
23+
It 'CheckExpandedFileWorkspace' {
24+
$fileWorkspaceResult = Test-AzSupportTicketNameAvailability -Name "test-ps-$(New-Guid)" -Type "Microsoft.Support/fileWorkspaces" -SubscriptionId $env.SubscriptionId
25+
$fileWorkspaceResult.NameAvailable | Should -Be $true
2126
}
2227

2328
It 'Check' -skip {

src/Support/Support.Autorest/test/Test-AzSupportTicketsNoSubscriptionNameAvailability.Tests.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ if(($null -eq $TestName) -or ($TestName -contains 'Test-AzSupportTicketsNoSubscr
1515
}
1616

1717
Describe 'Test-AzSupportTicketsNoSubscriptionNameAvailability' {
18-
It 'CheckExpanded' {
19-
$result = Test-AzSupportTicketsNoSubscriptionNameAvailability -Name "test-ps-$(New-Guid)" -Type "Microsoft.Support/supportTickets"
20-
$result.NameAvailable | Should -Be $true
18+
It 'CheckExpandedSupportTicket' {
19+
$supportTicketResult = Test-AzSupportTicketsNoSubscriptionNameAvailability -Name "test-ps-$(New-Guid)" -Type "Microsoft.Support/supportTickets"
20+
$supportTicketResult.NameAvailable | Should -Be $true
21+
}
22+
23+
It 'CheckExpandedFileWorkspace' {
24+
$fileWorkspaceResult = Test-AzSupportTicketsNoSubscriptionNameAvailability -Name "test-ps-$(New-Guid)" -Type "Microsoft.Support/fileWorkspaces"
25+
$fileWorkspaceResult.NameAvailable | Should -Be $true
2126
}
2227

2328
It 'Check' -skip {
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"Tenant": "d71d46f6-114f-4d2a-81c9-8fc86ba8801c",
3-
"BillingProblemClassificationId": "d0f16bf7-e011-3f3b-1c26-3147f84e0896",
42
"SubscriptionId": "4df09db9-7a7e-450b-8f88-00fb97c277bd",
3+
"FileWorkspaceNameSubscription": "test-ps-1c0f34c3-a77f-48f8-92ed-4bc40297b575",
4+
"FileWorkspaceNameNoSubscription": "test-ps-c3365113-f08e-4317-936c-3d948a9dc191",
5+
"Tenant": "d71d46f6-114f-4d2a-81c9-8fc86ba8801c",
56
"BillingServiceId": "517f2da6-78fd-0498-4e22-ad26996b1dfc",
6-
"FileWorkspaceNameNoSubscription": "test-ps-afd5e347-4c0f-444d-9119-8a0dcb829c96",
7-
"FileWorkspaceNameSubscription": "test-ps-56fe95cf-25df-4367-85d7-693e55a5f486"
7+
"BillingProblemClassificationId": "d0f16bf7-e011-3f3b-1c26-3147f84e0896"
88
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

src/Support/Support.Autorest/test/utils.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ function setupEnv() {
5252

5353
New-AzSupportFileWorkspace -Name $env.FileWorkspaceNameSubscription
5454
New-AzSupportFileWorkspacesNoSubscription -Name $env.FileWorkspaceNameNoSubscription
55-
55+
56+
$testFilePath = Join-Path $PSScriptRoot files test2.txt
57+
New-AzSupportFileAndUpload -WorkspaceName $env.FileWorkspaceNameSubscription -FilePath $testFilePath
58+
New-AzSupportFileAndUploadNoSubscription -WorkspaceName $env.FileWorkspaceNameNoSubscription -FilePath $testFilePath
59+
5660
$envFile = 'env.json'
5761
if ($TestMode -eq 'live') {
5862
$envFile = 'localEnv.json'

0 commit comments

Comments
 (0)