Skip to content

Commit

Permalink
update skip
Browse files Browse the repository at this point in the history
  • Loading branch information
grhuangmsft committed Mar 7, 2024
1 parent d953d52 commit d7835cf
Show file tree
Hide file tree
Showing 30 changed files with 413 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportChatTranscript')
# Chat functionality is unavailable for support tickets created outside the portal
Describe 'Get-AzSupportChatTranscript' {

It 'List' -Skip:!$env.HasSubscription{
It 'List' -skip:($env.HasSubscription -eq $false){
Mock Get-AzSupportChatTranscript{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ChatTranscriptDetails"}
Get-AzSupportChatTranscript -SupportTicketName $env.Name
Assert-MockCalled Get-AzSupportChatTranscript -Exactly 1
Expand All @@ -27,7 +27,7 @@ Describe 'Get-AzSupportChatTranscript' {
{ throw [System.NotImplementedException] } | Should -Not -Throw
}

It 'Get' -Skip:!$env.HasSubscription{
It 'Get' -skip:($env.HasSubscription -eq $false){
Mock Get-AzSupportChatTranscript{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ChatTranscriptDetails"}
Get-AzSupportChatTranscript -SupportTicketName $env.Name -Name "testChat"
Assert-MockCalled Get-AzSupportChatTranscript -Exactly 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportChatTranscriptsN

# Chat functionality is unavailable for support tickets created outside the portal
Describe 'Get-AzSupportChatTranscriptsNoSubscription' {
it 'List' -Skip:$env.HasSubscription {
it 'List' -skip:($env.HasSubscription -eq $true){
Mock Get-AzSupportChatTranscriptsNoSubscription{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ChatTranscriptDetails"}
Get-AzSupportChatTranscriptsNoSubscription
Get-AzSupportChatTranscriptsNoSubscription -SupportTicketName $env.Name
Assert-MockCalled Get-AzSupportChatTranscriptsNoSubscription -Exactly 1
}

It 'Get' -Skip:$env.HasSubscription {
It 'Get' -skip:($env.HasSubscription -eq $true){
Mock Get-AzSupportChatTranscriptsNoSubscription{ New-MockObject -Type "Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ChatTranscriptDetails"}
Get-AzSupportChatTranscriptsNoSubscription -SupportTicketName $env.Name -ChatTranscriptName "testChat"
Assert-MockCalled Get-AzSupportChatTranscriptsNoSubscription -Exactly 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportCommunication'))
if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportCommunication') -and ($env.HasSubscription -eq $true))
{
Write-Host "in Get-AzSupportCommunication env.HasSubscription: $(($env.HasSubscription -eq $true))"
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
if (-Not (Test-Path -Path $loadEnvPath)) {
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
Expand All @@ -16,7 +17,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportCommunication'))

Describe 'Get-AzSupportCommunication' {

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

Expand All @@ -37,7 +38,7 @@ Describe 'Get-AzSupportCommunication' {
{ throw [System.NotImplementedException] } | Should -Not -Throw
}

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

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportCommunicationsNo
}

Describe 'Get-AzSupportCommunicationsNoSubscription' {
It 'List' -Skip:$env.HasSubscription {
It 'List' -skip:($env.HasSubscription -eq $true) {
$supportMessages = Get-AzSupportCommunicationsNoSubscription -SupportTicketName $env.Name

$supportMessages.Count | Should -BeGreaterThan 0
}
It 'Get' -Skip:$env.HasSubscription {
It 'Get' -skip:($env.HasSubscription -eq $true){
# if($env.SupportPlanTenant -eq "Basic support" || $env.SupportPlanTenant -eq "Free"){
# write-host "cannot get communication operations for tickets with free support plan"

Expand Down
4 changes: 2 additions & 2 deletions src/Support/Support.Autorest/test/Get-AzSupportFile.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFile'))
}

Describe 'Get-AzSupportFile' {
It 'List' -Skip:!$env.HasSubscription{
It 'List' -skip:($env.HasSubscription -eq $false){
$files = Get-AzSupportFile -WorkspaceName $env.FileWorkspaceNameSubscription
$files | Should -Not -BeNullOrEmpty
$files.Count | Should -BeGreaterOrEqual 1
Expand All @@ -25,7 +25,7 @@ Describe 'Get-AzSupportFile' {
{ throw [System.NotImplementedException] } | Should -Not -Throw
}

It 'Get' -Skip:!$env.HasSubscription{
It 'Get' -skip:($env.HasSubscription -eq $false){
$file = Get-AzSupportFile -Name "test2.txt" -WorkspaceName $env.FileWorkspaceNameSubscription
$file | Should -Not -BeNullOrEmpty
$file.Name | Should -Be "test2.txt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFileWorkspace'))
}

Describe 'Get-AzSupportFileWorkspace' {
It 'Get' -Skip:!$env.HasSubscription{
It 'Get' -skip:($env.HasSubscription -eq $false){
$fileWorkspace = Get-AzSupportFileWorkspace -Name $env.FileWorkspaceNameSubscription
$fileWorkspace.Name | Should -Be $env.FileWorkspaceNameSubscription
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFileWorkspacesNo
}

Describe 'Get-AzSupportFileWorkspacesNoSubscription' {
It 'Get' -Skip:$env.HasSubscription{
It 'Get' -skip:($env.HasSubscription -eq $true){
$fileWorkspace = Get-AzSupportFileWorkspacesNoSubscription -Name $env.FileWorkspaceNameNoSubscription
$fileWorkspace.Name | Should -Be $env.FileWorkspaceNameNoSubscription
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportFilesNoSubscript
}

Describe 'Get-AzSupportFilesNoSubscription' {
It 'List' -Skip:$env.HasSubscription{
It 'List' -skip:($env.HasSubscription -eq $true) {
$files = Get-AzSupportFilesNoSubscription -WorkspaceName $env.FileWorkspaceNameNoSubscription
$files | Should -Not -BeNullOrEmpty
$files.Count | Should -BeGreaterOrEqual 1
Expand All @@ -25,8 +25,8 @@ Describe 'Get-AzSupportFilesNoSubscription' {
{ throw [System.NotImplementedException] } | Should -Not -Throw
}

It 'Get' -Skip:$env.HasSubscription{
$file = Get-AzSupportFile -Name "test2.txt" -WorkspaceName $env.FileWorkspaceNameSubscription
It 'Get' -skip:($env.HasSubscription -eq $true){
$file = Get-AzSupportFilesNoSubscription -Name "test2.txt" -WorkspaceName $env.FileWorkspaceNameSubscription
$file | Should -Not -BeNullOrEmpty
$file.Name | Should -Be "test2.txt"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSupportTicket'))
}

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

Expand All @@ -31,7 +31,7 @@ Describe 'Get-AzSupportTicket' {
# }
}

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

Expand Down
Loading

0 comments on commit d7835cf

Please sign in to comment.