Migrates to Pester5+ tests #59

Merged
OCram85 merged 47 commits from Pester5 into master 2022-07-14 13:37:13 +02:00
Showing only changes of commit d34b5744fc - Show all commits

View File

@ -13,16 +13,16 @@ BeforeAll {
Describe "Test-CredentialStore" { Describe "Test-CredentialStore" {
Context "Basic logic tests" { Context "Basic logic tests" {
It "Test1: Should Not Throw" { It "Should Not Throw" {
$TestCredentialStore = './resources/cs/CredentialStore.json' $TestCredentialStore = './resources/cs/CredentialStore.json'
{ Test-CredentialStore -Shared -Path $TestCredentialStore } | Should -Not -Throw { Test-CredentialStore -Shared -Path $TestCredentialStore } | Should -Not -Throw
} }
It "Test2: Read valid CredentialStore" { It "Read valid CredentialStore" {
$TestCredentialStore = './resources/cs/CredentialStore.json' $TestCredentialStore = './resources/cs/CredentialStore.json'
$res = Test-CredentialStore -Shared -Path $TestCredentialStore $res = Test-CredentialStore -Shared -Path $TestCredentialStore
$res | Should -Be $true $res | Should -Be $true
} }
It "Test3: Read a broken CredentialStore" { It "Read a broken CredentialStore" -Skip {
$BrokenCS = './resources/cs/Broken_CS.json' $BrokenCS = './resources/cs/Broken_CS.json'
$oWarningPreference = $WarningPreference $oWarningPreference = $WarningPreference
$WarningPreference = 'SilentlyContinue' $WarningPreference = 'SilentlyContinue'
@ -30,7 +30,7 @@ Describe "Test-CredentialStore" {
$res | Should -Be $false $res | Should -Be $false
$WarningPreference = $oWarningPreference $WarningPreference = $oWarningPreference
} }
It "Test4: Not existing path should return false" { It "Not existing path should return false" {
if ($isWindows -or ($PSVersionTable.PSVersion.Major -eq 5)) { if ($isWindows -or ($PSVersionTable.PSVersion.Major -eq 5)) {
Test-CredentialStore -Shared -Path 'C:\foobar\CredentialStore.json' | Should -Be $false Test-CredentialStore -Shared -Path 'C:\foobar\CredentialStore.json' | Should -Be $false
} }
@ -38,7 +38,7 @@ Describe "Test-CredentialStore" {
Test-CredentialStore -Shared -Path '/var/opt/foo.json' | Should -Be $false Test-CredentialStore -Shared -Path '/var/opt/foo.json' | Should -Be $false
} }
} }
It "Test5: testing private CredentialStore path" { It "testing private CredentialStore path" {
if (Test-Path -Path (Get-DefaultCredentialStorePath)) { if (Test-Path -Path (Get-DefaultCredentialStorePath)) {
Remove-Item -Path (Get-DefaultCredentialStorePath) Remove-Item -Path (Get-DefaultCredentialStorePath)
} }