Skip to content

Commit

Permalink
Merge pull request #1409 from microsoft/dev
Browse files Browse the repository at this point in the history
update 4.24 with unit test corrections
  • Loading branch information
MrAutomater authored Dec 9, 2024
2 parents 87546a3 + 05f15f5 commit e3a5a91
Showing 1 changed file with 55 additions and 55 deletions.
110 changes: 55 additions & 55 deletions Tests/Unit/Module/STIG.BackupRevert.tests.ps1
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
}

}

0 comments on commit e3a5a91

Please sign in to comment.