Skip to content

Commit d953d52

Browse files
committed
init add changes to split subscription and no subscription tests
1 parent 68944c1 commit d953d52

25 files changed

+211
-140
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportChatTranscript')
1717
# Chat functionality is unavailable for support tickets created outside the portal
1818
Describe 'Get-AzSupportChatTranscript' {
1919

20-
It 'List' {
20+
It 'List' -Skip:!$env.HasSubscription{
2121
Mock Get-AzSupportChatTranscript{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ChatTranscriptDetails"}
2222
Get-AzSupportChatTranscript -SupportTicketName $env.Name
2323
Assert-MockCalled Get-AzSupportChatTranscript -Exactly 1
@@ -27,7 +27,7 @@ Describe 'Get-AzSupportChatTranscript' {
2727
{ throw [System.NotImplementedException] } | Should -Not -Throw
2828
}
2929

30-
It 'Get' {
30+
It 'Get' -Skip:!$env.HasSubscription{
3131
Mock Get-AzSupportChatTranscript{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ChatTranscriptDetails"}
3232
Get-AzSupportChatTranscript -SupportTicketName $env.Name -Name "testChat"
3333
Assert-MockCalled Get-AzSupportChatTranscript -Exactly 2

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportChatTranscriptsN
1616

1717
# Chat functionality is unavailable for support tickets created outside the portal
1818
Describe 'Get-AzSupportChatTranscriptsNoSubscription' {
19-
It 'Get' {
19+
it 'List' -Skip:$env.HasSubscription {
2020
Mock Get-AzSupportChatTranscriptsNoSubscription{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ChatTranscriptDetails"}
21-
Get-AzSupportChatTranscriptsNoSubscription -SupportTicketName $env.Name -ChatTranscriptName "testChat"
21+
Get-AzSupportChatTranscriptsNoSubscription
2222
Assert-MockCalled Get-AzSupportChatTranscriptsNoSubscription -Exactly 1
2323
}
2424

25+
It 'Get' -Skip:$env.HasSubscription {
26+
Mock Get-AzSupportChatTranscriptsNoSubscription{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ChatTranscriptDetails"}
27+
Get-AzSupportChatTranscriptsNoSubscription -SupportTicketName $env.Name -ChatTranscriptName "testChat"
28+
Assert-MockCalled Get-AzSupportChatTranscriptsNoSubscription -Exactly 2
29+
}
30+
2531
It 'GetViaIdentitySupportTicket' -skip {
2632
{ throw [System.NotImplementedException] } | Should -Not -Throw
2733
}

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,42 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportCommunication'))
1616

1717
Describe 'Get-AzSupportCommunication' {
1818

19-
It 'List' {
20-
if($env.SupportPlanSubscription -eq "Basic support" || $env.SupportPlanSubscription -eq "Free"){
21-
write-host "cannot get communication operations for tickets with free support plan"
19+
It 'List' -Skip:!$env.HasSubscription {
20+
# if($env.SupportPlanSubscription -eq "Basic support" || $env.SupportPlanSubscription -eq "Free"){
21+
# write-host "cannot get communication operations for tickets with free support plan"
2222

23-
Mock Get-AzSupportCommunication{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.CommunicationDetails"}
23+
# Mock Get-AzSupportCommunication{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.CommunicationDetails"}
2424

25-
Get-AzSupportCommunication -SupportTicketName $env.Name
25+
# Get-AzSupportCommunication -SupportTicketName $env.Name
2626

27-
Assert-MockCalled Get-AzSupportCommunication -Exactly 1
28-
}
29-
else{
27+
# Assert-MockCalled Get-AzSupportCommunication -Exactly 1
28+
# }
29+
# else{
3030
$supportMessage = Get-AzSupportCommunication -SupportTicketName $env.Name
3131

3232
$supportMessage.Count | Should -BeGreaterThan 0
33-
}
33+
# }
3434
}
3535

3636
It 'GetViaIdentitySupportTicket' -skip {
3737
{ throw [System.NotImplementedException] } | Should -Not -Throw
3838
}
3939

40-
It 'Get' {
41-
if($env.SupportPlanSubscription -eq "Basic support" || $env.SupportPlanSubscription -eq "Free"){
42-
write-host "cannot get communication operations for tickets with free support plan"
40+
It 'Get' -Skip:!$env.HasSubscription {
41+
# if($env.SupportPlanSubscription -eq "Basic support" || $env.SupportPlanSubscription -eq "Free"){
42+
# write-host "cannot get communication operations for tickets with free support plan"
4343

44-
Mock Get-AzSupportCommunication{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.CommunicationDetails"}
44+
# Mock Get-AzSupportCommunication{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.CommunicationDetails"}
4545

46-
Get-AzSupportCommunication -SupportTicketName $env.Name -CommunicationName $env.CommunicationName
46+
# Get-AzSupportCommunication -SupportTicketName $env.Name -CommunicationName $env.CommunicationName
4747

48-
Assert-MockCalled Get-AzSupportCommunication -Exactly 2
49-
}
50-
else{
48+
# Assert-MockCalled Get-AzSupportCommunication -Exactly 2
49+
# }
50+
# else{
5151
$supportMessage = Get-AzSupportCommunication -CommunicationName $env.CommunicationName -SupportTicketName $env.Name
5252

5353
$supportMessage.Body.ToString() | Should -Match $env.Body
54-
}
54+
# }
5555
}
5656

5757
It 'GetViaIdentity' -skip {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportCommunicationsNo
1515
}
1616

1717
Describe 'Get-AzSupportCommunicationsNoSubscription' {
18-
19-
It 'Get' {
18+
It 'List' -Skip:$env.HasSubscription {
19+
$supportMessages = Get-AzSupportCommunicationsNoSubscription -SupportTicketName $env.Name
20+
21+
$supportMessages.Count | Should -BeGreaterThan 0
22+
}
23+
It 'Get' -Skip:$env.HasSubscription {
2024
# if($env.SupportPlanTenant -eq "Basic support" || $env.SupportPlanTenant -eq "Free"){
2125
# write-host "cannot get communication operations for tickets with free support plan"
2226

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

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

1717
Describe 'Get-AzSupportFile' {
18-
It 'List' {
18+
It 'List' -Skip:!$env.HasSubscription{
1919
$files = Get-AzSupportFile -WorkspaceName $env.FileWorkspaceNameSubscription
2020
$files | Should -Not -BeNullOrEmpty
2121
$files.Count | Should -BeGreaterOrEqual 1
@@ -25,7 +25,7 @@ Describe 'Get-AzSupportFile' {
2525
{ throw [System.NotImplementedException] } | Should -Not -Throw
2626
}
2727

28-
It 'Get' {
28+
It 'Get' -Skip:!$env.HasSubscription{
2929
$file = Get-AzSupportFile -Name "test2.txt" -WorkspaceName $env.FileWorkspaceNameSubscription
3030
$file | Should -Not -BeNullOrEmpty
3131
$file.Name | Should -Be "test2.txt"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFileWorkspace'))
1515
}
1616

1717
Describe 'Get-AzSupportFileWorkspace' {
18-
It 'Get' {
18+
It 'Get' -Skip:!$env.HasSubscription{
1919
$fileWorkspace = Get-AzSupportFileWorkspace -Name $env.FileWorkspaceNameSubscription
2020
$fileWorkspace.Name | Should -Be $env.FileWorkspaceNameSubscription
2121
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFileWorkspacesNo
1515
}
1616

1717
Describe 'Get-AzSupportFileWorkspacesNoSubscription' {
18-
It 'Get' {
18+
It 'Get' -Skip:$env.HasSubscription{
1919
$fileWorkspace = Get-AzSupportFileWorkspacesNoSubscription -Name $env.FileWorkspaceNameNoSubscription
2020
$fileWorkspace.Name | Should -Be $env.FileWorkspaceNameNoSubscription
2121
}

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

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

1717
Describe 'Get-AzSupportFilesNoSubscription' {
18-
It 'List' {
18+
It 'List' -Skip:$env.HasSubscription{
1919
$files = Get-AzSupportFilesNoSubscription -WorkspaceName $env.FileWorkspaceNameNoSubscription
2020
$files | Should -Not -BeNullOrEmpty
2121
$files.Count | Should -BeGreaterOrEqual 1
@@ -25,7 +25,7 @@ Describe 'Get-AzSupportFilesNoSubscription' {
2525
{ throw [System.NotImplementedException] } | Should -Not -Throw
2626
}
2727

28-
It 'Get' {
28+
It 'Get' -Skip:$env.HasSubscription{
2929
$file = Get-AzSupportFile -Name "test2.txt" -WorkspaceName $env.FileWorkspaceNameSubscription
3030
$file | Should -Not -BeNullOrEmpty
3131
$file.Name | Should -Be "test2.txt"

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,36 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportTicket'))
1515
}
1616

1717
Describe 'Get-AzSupportTicket' {
18-
It 'List' {
19-
if($env.SupportPlanSubscription -eq "Basic support" || $env.SupportPlanSubscription -eq "Free"){
20-
write-host "cannot get support tickets with free support plan"
18+
It 'List' -Skip:!$env.HasSubscription{
19+
# if($env.SupportPlanSubscription -eq "Basic support" || $env.SupportPlanSubscription -eq "Free"){
20+
# write-host "cannot get support tickets with free support plan"
2121

22-
Mock Get-AzSupportTicket{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.SupportTicketDetails"}
22+
# Mock Get-AzSupportTicket{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.SupportTicketDetails"}
2323

24-
Get-AzSupportTicket
24+
# Get-AzSupportTicket
2525

26-
Assert-MockCalled Get-AzSupportTicket -Exactly 1
27-
}
28-
else{
26+
# Assert-MockCalled Get-AzSupportTicket -Exactly 1
27+
# }
28+
# else{
2929
$supportTickets = Get-AzSupportTicket
3030
$supportTickets.Count | Should -BeGreaterThan 0
31-
}
31+
# }
3232
}
3333

34-
It 'Get' {
35-
if($env.SupportPlanSubscription -eq "Basic support" || $env.SupportPlanSubscription -eq "Free"){
36-
write-host "cannot get support tickets with free support plan"
34+
It 'Get' -Skip:!$env.HasSubscription{
35+
# if($env.SupportPlanSubscription -eq "Basic support" || $env.SupportPlanSubscription -eq "Free"){
36+
# write-host "cannot get support tickets with free support plan"
3737

38-
Mock Get-AzSupportTicket{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.SupportTicketDetails"}
38+
# Mock Get-AzSupportTicket{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.SupportTicketDetails"}
3939

40-
Get-AzSupportTicket -SupportTicketName $env.Name
40+
# Get-AzSupportTicket -SupportTicketName $env.Name
4141

42-
Assert-MockCalled Get-AzSupportTicket -Exactly 2
43-
}
44-
else{
42+
# Assert-MockCalled Get-AzSupportTicket -Exactly 2
43+
# }
44+
# else{
4545
$supportTicket = Get-AzSupportTicket -SupportTicketName $env.Name
4646
$supportTicket.Description | Should -Be "test ticket - please ignore and close"
47-
}
47+
# }
4848
}
4949

5050
It 'GetViaIdentity' -skip {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportTicketsNoSubscri
1515
}
1616

1717
Describe 'Get-AzSupportTicketsNoSubscription' {
18-
It 'List' {
18+
It 'List' -Skip:$env.HasSubscription{
1919
# if($env.SupportPlanTenant -eq "Basic support" || $env.SupportPlanTenant -eq "Free"){
2020
# write-host "cannot get support tickets with free support plan"
2121

@@ -31,7 +31,7 @@ Describe 'Get-AzSupportTicketsNoSubscription' {
3131
# }
3232
}
3333

34-
It 'Get' {
34+
It 'Get' -Skip:$env.HasSubscription{
3535
# if($env.SupportPlanTenant -eq "Basic support" || $env.SupportPlanTenant -eq "Free"){
3636
# write-host "cannot get support tickets with free support plan"
3737

0 commit comments

Comments
 (0)