-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1409 from microsoft/dev
update 4.24 with unit test corrections
- Loading branch information
Showing
1 changed file
with
55 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
#region Header | ||
. $PSScriptRoot\.tests.header.ps1 | ||
#endregion | ||
|
||
Describe 'Backup-StigSettings' { | ||
|
||
$get = @{ | ||
MitigationValue = "False" | ||
} | ||
|
||
Mock Invoke-DscResource -MockWith { return $get } | ||
|
||
It 'Should not throw WindowsServer' { | ||
{Backup-StigSettings -StigName "WindowsServer-2019-MS-3.2.xml"} | Should -not -Throw | ||
} | ||
|
||
It 'Should not throw WindowsClient' { | ||
{Backup-StigSettings -StigName "WindowsClient-10-3.2.xml"} | Should -not -Throw | ||
} | ||
|
||
It 'Should not throw Sql Server 2016' { | ||
{Backup-StigSettings -StigName "SqlServer-2016-Instance-3.2.xml"} | Should -not -Throw | ||
} | ||
|
||
It 'Should return string with valid STIGs' { | ||
Backup-StigSettings -StigName "wrong.xml" | Should -BeOfType System.String | ||
} | ||
|
||
$test = Get-ChildItem $ENV:TEMP | Where-Object Name -like *.csv | ||
It 'Should create a backup of current STIG Settings' { | ||
$test | Should -Not -BeNullOrEmpty | ||
} | ||
} | ||
|
||
Describe 'Restore-StigSettings' { | ||
|
||
$get = @{ | ||
MitigationValue = "False" | ||
} | ||
|
||
Mock -CommandName Invoke-DscResource -MockWith {return $get} | ||
|
||
It 'Should not throw for Server' { | ||
{Restore-StigSettings -StigName "WindowsServer-2019-MS-3.2.xml" -Confirm:$false} | Should -Not -Throw | ||
} | ||
|
||
It 'Should not throw for Client' { | ||
{Restore-StigSettings -StigName "WindowsClient-10-3.2.xml" -Confirm:$false} | Should -Not -Throw | ||
} | ||
|
||
It 'Should not throw for Sql Server 2016' { | ||
{Restore-StigSettings -StigName "SqlServer-2016-Instance-3.2.xml" -Confirm:$false} | Should -Not -Throw | ||
} | ||
|
||
} | ||
#region Header | ||
. $PSScriptRoot\.tests.header.ps1 | ||
#endregion | ||
|
||
Describe 'Backup-StigSettings' { | ||
|
||
$get = @{ | ||
MitigationValue = "False" | ||
} | ||
|
||
Mock Invoke-DscResource -MockWith { return $get } | ||
|
||
It 'Should not throw WindowsServer' { | ||
{Backup-StigSettings -StigName "WindowsServer-2019-MS-3.2.xml"} | Should -not -Throw | ||
} | ||
|
||
It 'Should not throw WindowsClient' { | ||
{Backup-StigSettings -StigName "WindowsClient-10-3.2.xml"} | Should -not -Throw | ||
} | ||
|
||
It 'Should not throw Sql Server 2016' { | ||
{Backup-StigSettings -StigName "SqlServer-2016-Instance-3.2.xml"} | Should -not -Throw | ||
} | ||
|
||
It 'Should return string with valid STIGs' { | ||
Backup-StigSettings -StigName "wrong.xml" | Should -BeOfType System.String | ||
} | ||
|
||
$test = Get-ChildItem $ENV:TEMP | Where-Object Name -like *.csv | ||
It 'Should create a backup of current STIG Settings' { | ||
$test | Should -Not -BeNullOrEmpty | ||
} | ||
} | ||
|
||
Describe 'Restore-StigSettings' { | ||
|
||
$get = @{ | ||
MitigationValue = "False" | ||
} | ||
|
||
Mock -CommandName Invoke-DscResource -MockWith {return $get} | ||
|
||
It 'Should not throw for Server' { | ||
{Restore-StigSettings -StigName "WindowsServer-2019-MS-3.2.xml" -Confirm:$false} | Should -Not -Throw | ||
} | ||
|
||
It 'Should not throw for Client' { | ||
{Restore-StigSettings -StigName "WindowsClient-10-3.2.xml" -Confirm:$false} | Should -Not -Throw | ||
} | ||
|
||
It 'Should not throw for Sql Server 2016' { | ||
{Restore-StigSettings -StigName "SqlServer-2016-Instance-3.2.xml" -Confirm:$false} | Should -Not -Throw | ||
} | ||
|
||
} |