Skip to content

Commit 62c9ee4

Browse files
committed
Fix tests needing package updates
1 parent ad85cf1 commit 62c9ee4

3 files changed

Lines changed: 32 additions & 31 deletions

File tree

test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -248,23 +248,23 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'ManualValidatio
248248
$pkg.Path.Contains("/usr/") | Should -Be $true
249249
}
250250

251-
# # This needs to be manually tested due to prompt
252-
# It "Install resource that requires accept license without -AcceptLicense flag" {
253-
# Install-PSResource -Name $testModuleName2 -Repository $TestGalleryName
254-
# $pkg = Get-InstalledPSResource $testModuleName2
255-
# $pkg.Name | Should -Be $testModuleName2
256-
# $pkg.Version | Should -Be "0.0.1.0"
257-
# }
258-
259-
# # This needs to be manually tested due to prompt
260-
# It "Install resource should prompt 'trust repository' if repository is not trusted" {
261-
# Set-PSResourceRepository PoshTestGallery -Trusted:$false
262-
263-
# Install-PSResource -Name $testModuleName -Repository $TestGalleryName -confirm:$false
251+
# This needs to be manually tested due to prompt
252+
It "Install resource that requires accept license without -AcceptLicense flag" {
253+
Install-PSResource -Name $testModuleName2 -Repository $TestGalleryName
254+
$pkg = Get-InstalledPSResource $testModuleName2
255+
$pkg.Name | Should -Be $testModuleName2
256+
$pkg.Version | Should -Be "0.0.1.0"
257+
}
258+
259+
# This needs to be manually tested due to prompt
260+
It "Install resource should prompt 'trust repository' if repository is not trusted" {
261+
Set-PSResourceRepository PoshTestGallery -Trusted:$false
262+
263+
Install-PSResource -Name $testModuleName -Repository $TestGalleryName -confirm:$false
264264

265-
# $pkg = Get-Module $testModuleName -ListAvailable
266-
# $pkg.Name | Should -Be $testModuleName
265+
$pkg = Get-Module $testModuleName -ListAvailable
266+
$pkg.Name | Should -Be $testModuleName
267267

268-
# Set-PSResourceRepository PoshTestGallery -Trusted
269-
# }
268+
Set-PSResourceRepository PoshTestGallery -Trusted
269+
}
270270
}

test/InstallPSResourceTests/InstallPSResourceV3Server.Tests.ps1

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'CI' {
2727
}
2828

2929
AfterEach {
30-
Uninstall-PSResource 'test_module', 'test_module2', 'test_script', 'TestModule99', 'test_module_with_license', 'TestFindModule', 'PackageManagement' -SkipDependencyCheck -ErrorAction SilentlyContinue
30+
Uninstall-PSResource 'test_module', 'test_module2', 'test_script', 'TestModule99', 'test_module_withlicense', 'TestFindModule', 'PackageManagement', `
31+
'TestModuleWithDependencyE', 'TestModuleWithDependencyC', 'TestModuleWithDependencyB', 'TestModuleWithDependencyD' -SkipDependencyCheck -ErrorAction SilentlyContinue
3132
}
3233

3334
AfterAll {
@@ -45,7 +46,7 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'CI' {
4546
Install-PSResource -Name $Name -Repository $NuGetGalleryName -ErrorVariable err -ErrorAction SilentlyContinue
4647
$err.Count | Should -BeGreaterThan 0
4748
$err[0].FullyQualifiedErrorId | Should -BeExactly "$ErrorId,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
48-
$res = Get-InstalledPSResource $testModuleName
49+
$res = Get-InstalledPSResource $testModuleName -ErrorAction SilentlyContinue
4950
$res | Should -BeNullOrEmpty
5051
}
5152

@@ -82,7 +83,7 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'CI' {
8283
Install-PSResource -Name $testModuleName -Repository $NuGetGalleryName -TrustRepository -WhatIf
8384
$? | Should -BeTrue
8485

85-
$res = Get-InstalledPSResource $testModuleName
86+
$res = Get-InstalledPSResource $testModuleName -ErrorAction SilentlyContinue
8687
$res | Should -BeNullOrEmpty
8788
}
8889

@@ -258,10 +259,10 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'CI' {
258259
# }
259260

260261
It 'Install resource that requires accept license with -AcceptLicense flag' {
261-
Install-PSResource -Name 'test_module_with_license' -Repository $NuGetGalleryName -AcceptLicense
262-
$pkg = Get-InstalledPSResource 'test_module_with_license'
263-
$pkg.Name | Should -Be 'test_module_with_license'
264-
$pkg.Version | Should -Be '2.0.0'
262+
Install-PSResource -Name 'test_module_withlicense' -Repository $NuGetGalleryName -AcceptLicense
263+
$pkg = Get-InstalledPSResource 'test_module_withlicense'
264+
$pkg.Name | Should -Be 'test_module_withlicense'
265+
$pkg.Version | Should -Be '1.0.0'
265266
}
266267

267268
It 'Install PSResourceInfo object piped in' {
@@ -388,7 +389,7 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'ManualValidatio
388389

389390
BeforeAll {
390391
$testModuleName = 'TestModule'
391-
$testModuleName2 = 'test_module_with_license'
392+
$testModuleName2 = 'test_module_withlicense'
392393
Get-NewPSResourceRepositoryFile
393394
Register-LocalRepos
394395
}
@@ -415,7 +416,7 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'ManualValidatio
415416
Install-PSResource -Name $testModuleName2 -Repository $TestGalleryName
416417
$pkg = Get-InstalledPSResource $testModuleName2
417418
$pkg.Name | Should -Be $testModuleName2
418-
$pkg.Version | Should -Be '2.0.0'
419+
$pkg.Version | Should -Be '1.0.0'
419420
}
420421

421422
# This needs to be manually tested due to prompt

test/SavePSResourceTests/SavePSResourceV3Tests.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,16 @@ Describe 'Test HTTP Save-PSResource for V3 Server Protocol' -tags 'CI' {
144144
It 'Save module that is not authenticode signed' -Skip:(!(Get-IsWindows)) {
145145
Save-PSResource -Name $testModuleName -Version '5.0.0' -AuthenticodeCheck -Repository $NuGetGalleryName -TrustRepository -Path $SaveDir -ErrorVariable err -ErrorAction SilentlyContinue
146146
$err.Count | Should -BeGreaterThan 0
147-
$err[0].FullyQualifiedErrorId | Should -BeExactly 'InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource'
147+
$err[0].FullyQualifiedErrorId | Should -BeExactly 'GetAuthenticodeSignatureError,Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource'
148148
}
149149

150150
# Save resource that requires license
151151
It 'Install resource that requires accept license with -AcceptLicense flag' {
152152
Save-PSResource -Repository $NuGetGalleryName -TrustRepository -Path $SaveDir `
153-
-Name 'test_module_with_license' -AcceptLicense
154-
$pkg = Get-InstalledPSResource -Path $SaveDir 'test_module_with_license'
155-
$pkg.Name | Should -Be 'test_module_with_license'
156-
$pkg.Version | Should -Be '2.0.0'
153+
-Name 'test_module_withlicense' -AcceptLicense
154+
$pkg = Get-InstalledPSResource -Path $SaveDir 'test_module_withlicense'
155+
$pkg.Name | Should -Be 'test_module_withlicense'
156+
$pkg.Version | Should -Be '1.0.0'
157157
}
158158

159159
It "Save module and its dependencies" {

0 commit comments

Comments
 (0)