Skip to content

Commit 90f842c

Browse files
Fix operations
1 parent 076d164 commit 90f842c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/GroupPolicyEnforcement.Tests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ Describe 'GroupPolicyEnforcement Cmdlet Tests' -Tags 'CI' {
7878
It 'Install-PSResource is blocked by policy' -Skip:(-not $IsWindows) {
7979
try {
8080
Register-PSResourceRepository -Name 'Example' -Uri 'https://www.example.com/' -ApiVersion 'v3'
81-
{ Find-PSResource -Repository PSGallery -Name 'Az.Accounts' -ErrorAction Stop } | Should -Throw "Repository 'PSGallery' is not allowed by Group Policy."
81+
{ Install-PSResource -Repository PSGallery -Name 'Az.Accounts' -ErrorAction Stop } | Should -Throw "Repository 'PSGallery' is not allowed by Group Policy."
8282

8383
# Allow PSGallery and it should not fail
8484
[Microsoft.PowerShell.PSResourceGet.UtilClasses.InternalHooks]::SetTestHook('AllowedUri', " https://www.powershellgallery.com/api/v2")
85-
{ Find-PSResource -Repository PSGallery -Name 'Az.Accounts' -ErrorAction Stop } | Should -Not -Throw
85+
{ Install-PSResource -Repository PSGallery -Name 'Az.Accounts' -ErrorAction Stop -TrustRepository} | Should -Not -Throw
8686
}
8787
finally {
8888
Unregister-PSResourceRepository -Name 'Example'
@@ -92,11 +92,11 @@ Describe 'GroupPolicyEnforcement Cmdlet Tests' -Tags 'CI' {
9292
It 'Save-PSResource is blocked by policy' -Skip:(-not $IsWindows) {
9393
try {
9494
Register-PSResourceRepository -Name 'Example' -Uri 'https://www.example.com/' -ApiVersion 'v3'
95-
{ Find-PSResource -Repository PSGallery -Name 'Az.Accounts' -ErrorAction Stop } | Should -Throw "Repository 'PSGallery' is not allowed by Group Policy."
95+
{ Save-PSResource -Repository PSGallery -Name 'Az.Accounts' -ErrorAction Stop } | Should -Throw "Repository 'PSGallery' is not allowed by Group Policy."
9696

9797
# Allow PSGallery and it should not fail
9898
[Microsoft.PowerShell.PSResourceGet.UtilClasses.InternalHooks]::SetTestHook('AllowedUri', " https://www.powershellgallery.com/api/v2")
99-
{ Find-PSResource -Repository PSGallery -Name 'Az.Accounts' -ErrorAction Stop } | Should -Not -Throw
99+
{ Save-PSResource -Repository PSGallery -Name 'Az.Accounts' -ErrorAction Stop -TrustRepository} | Should -Not -Throw
100100
}
101101
finally {
102102
Unregister-PSResourceRepository -Name 'Example'

0 commit comments

Comments
 (0)