Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Borgquite committed Jun 14, 2024
1 parent e96472a commit f4d54a7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Tests/Unit/MSFT_UpdateServicesComputerTargetGroup.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ try
#region Function Get-ComputerTargetGroupPath
Describe "MSFT_UpdateServicesComputerTargetGroup\Get-ComputerTargetGroupPath." {
BeforeAll {
$WsusServer = Get-WsusServer
$script:WsusServer = Get-WsusServer
}

Context "The Function returns expected path for the 'All Computers' ComputerTargetGroup." {
$ComputerTargetGroup = $WsusServer.GetComputerTargetGroups() | Where-Object -FilterScript { $_.Name -eq 'All Computers' }
$ComputerTargetGroup = $script:WsusServer.GetComputerTargetGroups() | Where-Object -FilterScript { $_.Name -eq 'All Computers' }
$result = Get-ComputerTargetGroupPath -ComputerTargetGroup $ComputerTargetGroup
$result | Should -Be 'All Computers'
}

Context "The Function returns expected path for the 'Desktops' ComputerTargetGroup." {
$ComputerTargetGroup = $WsusServer.GetComputerTargetGroups() | Where-Object -FilterScript { $_.Name -eq 'Desktops' }
$ComputerTargetGroup = $script:WsusServer.GetComputerTargetGroups() | Where-Object -FilterScript { $_.Name -eq 'Desktops' }
$result = Get-ComputerTargetGroupPath -ComputerTargetGroup $ComputerTargetGroup
$result | Should -Be 'All Computers/Workstations'
}

Context "The Function returns expected path for the 'Workstations' ComputerTargetGroup." {
$ComputerTargetGroup = $WsusServer.GetComputerTargetGroups() | Where-Object -FilterScript { $_.Name -eq 'Workstations' }
$ComputerTargetGroup = $script:WsusServer.GetComputerTargetGroups() | Where-Object -FilterScript { $_.Name -eq 'Workstations' }
$result = Get-ComputerTargetGroupPath -ComputerTargetGroup $ComputerTargetGroup
$result | Should -Be 'All Computers'
}
Expand Down Expand Up @@ -72,7 +72,7 @@ try
Context 'The WSUS Server is not yet configured.' {
Mock -CommandName Get-WsusServer -MockWith {}

It 'Calling Get should not throw when the WSUS Server is not yet configuration / cannot be found.' {
It 'Calling Get should not throw when the WSUS Server is not yet configured / cannot be found.' {
{ $script:resource = Get-TargetResource -Name 'Servers' -Path 'All Computers'} | Should -Not -Throw
Assert-MockCalled -CommandName Write-Verbose -ParameterFilter {
$message -eq $script:localizedData.GetWsusServerFailed
Expand Down Expand Up @@ -222,7 +222,7 @@ try
Context 'An error occurs retrieving WSUS Server configuration information.' {
Mock -CommandName Get-WsusServer -MockWith { throw 'An error occurred.' }

It 'Calling Set should throw when an error occurrs retrieving WSUS Server information.' {
It 'Calling Set should throw when an error occurs retrieving WSUS Server information.' {
{ $script:resource = Set-TargetResource -Name 'Servers' -Path 'All Computers'} | Should -Throw ($script:localizedData.WSUSConfigurationFailed)
$script:resource | Should -Be $null
Assert-MockCalled -CommandName Get-WsusServer -Exactly 1
Expand Down

0 comments on commit f4d54a7

Please sign in to comment.