Merge pull request #1229 from ruandersMSFT/patch-1

Fix Unit Testing for valid STIG files
This commit is contained in:
Eric Jenkins 2023-06-26 10:40:32 -04:00 коммит произвёл GitHub
Родитель f2583e68d0 ed2f01850c
Коммит cf8a428988
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -15,11 +15,11 @@ Describe 'Backup-StigSettings' {
} }
It 'Should not throw WindowsClient' { It 'Should not throw WindowsClient' {
{Backup-StigSettings -StigName "WindowsClient-10-2.2.xml"} | Should -not -Throw {Backup-StigSettings -StigName "WindowsClient-10-2.5.xml"} | Should -not -Throw
} }
It 'Should not throw Sql Server 2016' { It 'Should not throw Sql Server 2016' {
{Backup-StigSettings -StigName "SqlServer-2016-Instance-2.3.xml"} | Should -not -Throw {Backup-StigSettings -StigName "SqlServer-2016-Instance-2.8.xml"} | Should -not -Throw
} }
It 'Should return string with valid STIGs' { It 'Should return string with valid STIGs' {
@ -45,11 +45,11 @@ Describe 'Restore-StigSettings' {
} }
It 'Should not throw for Client' { It 'Should not throw for Client' {
{Restore-StigSettings -StigName "WindowsClient-10-2.2.xml" -Confirm:$false} | Should -Not -Throw {Restore-StigSettings -StigName "WindowsClient-10-2.5.xml" -Confirm:$false} | Should -Not -Throw
} }
It 'Should not throw for Sql Server 2016' { It 'Should not throw for Sql Server 2016' {
{Restore-StigSettings -StigName "SqlServer-2016-Instance-2.3.xml" -Confirm:$false} | Should -Not -Throw {Restore-StigSettings -StigName "SqlServer-2016-Instance-2.8.xml" -Confirm:$false} | Should -Not -Throw
} }
} }

Просмотреть файл

@ -43,7 +43,7 @@ function Backup-StigSettings
if ($validStigs.Name -notContains $StigName.Trim()) if ($validStigs.Name -notContains $StigName.Trim())
{ {
$errorArray = $validStigs.Name -join("`n") $errorArray = $validStigs.Name -join("`n")
Write-Host "StigName not valid, options are :`n$errorArray" Write-Host "StigName '$($StigName.Trim())' not valid, options are :`n$errorArray"
break break
} }
@ -429,7 +429,7 @@ function Restore-StigSettings
if ($validStigs.Name -notContains $StigName.Trim()) if ($validStigs.Name -notContains $StigName.Trim())
{ {
$errorArray = $validStigs.Name -join("`n") $errorArray = $validStigs.Name -join("`n")
Write-Host "StigName not valid, options are :`n$errorArray" Write-Host "StigName '$($StigName.Trim())' not valid, options are :`n$errorArray"
break break
} }