Skip to content

Commit a2df53a

Browse files
Update expected values of test for packages from PSGallery (#1693)
1 parent 3989cbe commit a2df53a

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
5757
$pkg2 = $res[1]
5858
$pkg2.Name | Should -Be $testModuleName
5959
$pkg2.Repository | Should -Be $PSGalleryName
60-
60+
6161
$pkg3 = $res[2]
6262
$pkg3.Name | Should -Be $testModuleName
6363
$pkg3.Repository | Should -Be $NuGetGalleryName
@@ -210,7 +210,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
210210
It "should not allow for repository name with wildcard and non-wildcard name specified in same command run" {
211211
{Find-PSResource -Name "test_module" -Repository "*Gallery",$localRepoName} | Should -Throw -ErrorId "RepositoryNamesWithWildcardsAndNonWildcardUnsupported,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
212212
}
213-
213+
214214
It "not find resource and write error if resource does not exist in any pattern matching repositories (-Repository with wildcard)" {
215215
$res = Find-PSResource -Name "nonExistantPkg" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue
216216
$res | Should -BeNullOrEmpty
@@ -296,7 +296,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
296296
$pkg3 = $res[2]
297297
$pkg3.Name | Should -Be $testModuleName
298298
$pkg3.Repository | Should -Be $PSGalleryName
299-
299+
300300
# Note Find-PSResource -Tag returns package Ids in desc order
301301
$pkg4 = $res[3]
302302
$pkg4.Name | Should -Be $testModuleName
@@ -330,7 +330,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
330330
$res = Find-PSResource -Tag "NonExistantTag" -ErrorVariable err -ErrorAction SilentlyContinue
331331
$res | Should -HaveCount 0
332332
$err | Should -HaveCount 1
333-
$err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithTagsNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
333+
$err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithTagsNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
334334
}
335335

336336
It "not find resource when it has one tag specified but not other and report error (without -Repository specified)" {
@@ -380,7 +380,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
380380
$pkg2 = $res[1]
381381
$pkg2.Name | Should -Be $testModuleName
382382
$pkg2.Repository | Should -Be $PSGalleryName
383-
383+
384384
# Note Find-PSResource -Tag returns package Ids in desc order
385385
$pkg3 = $res[2]
386386
$pkg3.Name | Should -Be $testModuleName
@@ -394,7 +394,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
394394
It "should not allow for repository name with wildcard and non-wildcard name specified in same command run" {
395395
{Find-PSResource -Tag $tag1 -Repository "*Gallery",$localRepoName} | Should -Throw -ErrorId "RepositoryNamesWithWildcardsAndNonWildcardUnsupported,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
396396
}
397-
397+
398398
It "not find resource and write error if tag does not exist for resources in any pattern matching repositories (-Repository with wildcard)" {
399399
$res = Find-PSResource -Tag "NonExistantTag" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue
400400
$res | Should -BeNullOrEmpty
@@ -451,7 +451,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
451451

452452
$pkg2 = $res[1]
453453
$pkg2.Name | Should -Be "anam_script"
454-
$pkg2.Repository | Should -Be $PSGalleryName
454+
$pkg2.Repository | Should -Be $PSGalleryName
455455

456456
$err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithSpecifiedTagsNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
457457
}
@@ -461,7 +461,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
461461
# $cmdNameToSearch = "Get-TargetResource"
462462
$res = Find-PSResource -CommandName $cmdName -ErrorVariable err -ErrorAction SilentlyContinue
463463
$err | Should -HaveCount 0
464-
$res.Count | Should -BeGreaterOrEqual 10
464+
$res.Count | Should -BeGreaterOrEqual 9
465465
$pkgFoundFromLocalRepo = $false
466466
$pkgFoundFromPSGallery = $false
467467

@@ -477,7 +477,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
477477
}
478478
}
479479

480-
$pkg.Names | Should -Be $cmdName
480+
$pkg.Names | Should -Be $cmdName
481481
$pkg.ParentResource.Includes.Command | Should -Contain $cmdName
482482
$pkgFoundFromLocalRepo | Should -BeTrue
483483
$pkgFoundFromPSGallery | Should -BeTrue
@@ -487,7 +487,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
487487
$res = Find-PSResource -Command "NonExistantCommandName" -ErrorVariable err -ErrorAction SilentlyContinue
488488
$res | Should -HaveCount 0
489489
$err | Should -HaveCount 1
490-
$err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
490+
$err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
491491
}
492492

493493
It "not find resource when it has one CommandName specified but not other and report error (without -Repository specified)" {
@@ -509,7 +509,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
509509
$err | Should -HaveCount 1
510510
$err[0].FullyQualifiedErrorId | Should -BeExactly "WildcardsUnsupportedForCommandNameorDSCResourceName,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
511511

512-
$res.Count | Should -BeGreaterOrEqual 10
512+
$res.Count | Should -BeGreaterOrEqual 9
513513
$pkgFoundFromLocalRepo = $false
514514
$pkgFoundFromPSGallery = $false
515515

@@ -525,7 +525,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
525525
}
526526
}
527527

528-
$pkg.Names | Should -Be $cmdName
528+
$pkg.Names | Should -Be $cmdName
529529
$pkg.ParentResource.Includes.Command | Should -Contain $cmdName
530530
$pkgFoundFromLocalRepo | Should -BeTrue
531531
$pkgFoundFromPSGallery | Should -BeTrue
@@ -552,7 +552,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
552552
}
553553
}
554554

555-
$pkg.Names | Should -Be $cmdName
555+
$pkg.Names | Should -Be $cmdName
556556
$pkg.ParentResource.Includes.Command | Should -Contain $cmdName
557557
$pkgFoundFromLocalRepo | Should -BeFalse
558558
$pkgFoundFromPSGallery | Should -BeTrue
@@ -561,7 +561,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
561561
It "should not allow for repository name with wildcard and non-wildcard command name specified in same command run" {
562562
{Find-PSResource -CommandName $cmdName -Repository "*Gallery",$localRepoName} | Should -Throw -ErrorId "RepositoryNamesWithWildcardsAndNonWildcardUnsupported,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
563563
}
564-
564+
565565
It "not find resource and write error if tag does not exist for resources in any pattern matching repositories (-Repository with wildcard)" {
566566
$res = Find-PSResource -CommandName "NonExistantCommand" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue
567567
$res | Should -BeNullOrEmpty
@@ -592,7 +592,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
592592

593593
It "find resource given CommandName from all repositories where it exists (-Repository with multiple non-wildcard values)" {
594594
$res = Find-PSResource -CommandName $cmdName -Repository $PSGalleryName,$localRepoName
595-
$res.Count | Should -BeGreaterOrEqual 10
595+
$res.Count | Should -BeGreaterOrEqual 9
596596

597597
$pkgFoundFromLocalRepo = $false
598598
$pkgFoundFromPSGallery = $false
@@ -609,7 +609,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
609609
}
610610
}
611611

612-
$pkg.Names | Should -Be $cmdName
612+
$pkg.Names | Should -Be $cmdName
613613
$pkg.ParentResource.Includes.Command | Should -Contain $cmdName
614614
$pkgFoundFromLocalRepo | Should -BeTrue
615615
$pkgFoundFromPSGallery | Should -BeTrue
@@ -636,10 +636,10 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
636636
}
637637
}
638638

639-
$pkg.Names | Should -Be $cmdName2
639+
$pkg.Names | Should -Be $cmdName2
640640
$pkg.ParentResource.Includes.Command | Should -Contain $cmdName2
641641
$pkgFoundFromLocalRepo | Should -BeTrue
642-
$pkgFoundFromPSGallery | Should -BeFalse
642+
$pkgFoundFromPSGallery | Should -BeFalse
643643

644644
$err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithSpecifiedCmdOrDSCNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
645645
}
@@ -681,7 +681,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
681681
It "find resource that has DSCResourceName specified from all repositories where it exists and not write errors where it does not exist (without -Repository specified)" {
682682
$res = Find-PSResource -DscResourceName $dscName -ErrorVariable err -ErrorAction SilentlyContinue
683683
$err | Should -HaveCount 0
684-
$res.Count | Should -BeGreaterOrEqual 3
684+
$res.Count | Should -BeGreaterOrEqual 2
685685
$pkgFoundFromLocalRepo = $false
686686
$pkgFoundFromPSGallery = $false
687687

@@ -697,7 +697,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
697697
}
698698
}
699699

700-
$pkg.Names | Should -Be $dscName
700+
$pkg.Names | Should -Be $dscName
701701
$pkg.ParentResource.Includes.DscResource | Should -Contain $dscName
702702
$pkgFoundFromLocalRepo | Should -BeTrue
703703
$pkgFoundFromPSGallery | Should -BeTrue
@@ -707,7 +707,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
707707
$res = Find-PSResource -DscResourceName "NonExistantDSCResourceName" -ErrorVariable err -ErrorAction SilentlyContinue
708708
$res | Should -HaveCount 0
709709
$err | Should -HaveCount 1
710-
$err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
710+
$err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithCmdOrDscNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
711711
}
712712

713713
It "not find resource when it has one DSCResourceName specified but not other and report error (without -Repository specified)" {
@@ -729,7 +729,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
729729
$err | Should -HaveCount 1
730730
$err[0].FullyQualifiedErrorId | Should -BeExactly "WildcardsUnsupportedForCommandNameorDSCResourceName,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
731731

732-
$res.Count | Should -BeGreaterOrEqual 3
732+
$res.Count | Should -BeGreaterOrEqual 2
733733
$pkgFoundFromLocalRepo = $false
734734
$pkgFoundFromPSGallery = $false
735735

@@ -772,7 +772,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
772772
}
773773
}
774774

775-
$pkg.Names | Should -Be $dscName
775+
$pkg.Names | Should -Be $dscName
776776
$pkg.ParentResource.Includes.DscResource | Should -Contain $dscName
777777
$pkgFoundFromLocalRepo | Should -BeFalse
778778
$pkgFoundFromPSGallery | Should -BeTrue
@@ -781,7 +781,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
781781
It "should not allow for repository name with wildcard and non-wildcard command name specified in same command run" {
782782
{Find-PSResource -DscResourceName $dscName -Repository "*Gallery",$localRepoName} | Should -Throw -ErrorId "RepositoryNamesWithWildcardsAndNonWildcardUnsupported,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
783783
}
784-
784+
785785
It "not find resource and write error if tag does not exist for resources in any pattern matching repositories (-Repository with wildcard)" {
786786
$res = Find-PSResource -DscResourceName "NonExistantDSCResource" -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue
787787
$res | Should -BeNullOrEmpty
@@ -830,7 +830,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
830830
}
831831
}
832832

833-
$pkg.Names | Should -Be $dscName
833+
$pkg.Names | Should -Be $dscName
834834
$pkg.ParentResource.Includes.DscResource | Should -Contain $dscName
835835
$pkgFoundFromLocalRepo | Should -BeTrue
836836
$pkgFoundFromPSGallery | Should -BeTrue
@@ -860,7 +860,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
860860
$pkg.Names | Should -Be $dscName2
861861
$pkg.ParentResource.Includes.DscResource | Should -Contain $dscName2
862862
$pkgFoundFromLocalRepo | Should -BeTrue
863-
$pkgFoundFromPSGallery | Should -BeFalse
863+
$pkgFoundFromPSGallery | Should -BeFalse
864864

865865
$err[0].FullyQualifiedErrorId | Should -BeExactly "PackageWithSpecifiedCmdOrDSCNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
866866
}
@@ -891,7 +891,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
891891
}
892892
}
893893

894-
$pkg.Names | Should -Be $dscName
894+
$pkg.Names | Should -Be $dscName
895895
$pkg.ParentResource.Includes.DscResource | Should -Contain $dscName
896896
$pkgFoundFromLocalRepo | Should -BeTrue
897897
$pkgFoundFromPSGallery | Should -BeFalse

0 commit comments

Comments
 (0)