From 8bc8135775a6720e825ccc065468aae7d4e1a0d0 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Thu, 4 Apr 2019 15:52:32 +0200 Subject: [PATCH] fix pester test for linux --- tests/Store/02_New-CredentialStore.Tests.ps1 | 33 +++++++++----------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/Store/02_New-CredentialStore.Tests.ps1 b/tests/Store/02_New-CredentialStore.Tests.ps1 index ea1fc02..4400798 100644 --- a/tests/Store/02_New-CredentialStore.Tests.ps1 +++ b/tests/Store/02_New-CredentialStore.Tests.ps1 @@ -76,26 +76,23 @@ Describe "New-CredentialStore" { } Context "Tests for Windows certificate store" { It "Create new private store and skip certificate linking" { - if (! $isLinux) { - { New-CredentialStore -UseCertStore -Force } | Should -Not -Throw - $CS = Get-CredentialStore - $CS.PfxCertificate | Should -Be $null - $CS.Thumbprint | Should -Not -Be $null - } - else { - { New-CredentialStore -UseCertStore -Force } | Should -Throw - } + { New-CredentialStore -UseCertStore -Force } | Should -Not -Throw + $CS = Get-CredentialStore + $CS.PfxCertificate | Should -Be $null + $CS.Thumbprint | Should -Not -Be $null + $res = Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation CurrentUser + Write-Verbose -Message ('res: {0}' -f $res) -Verbose + $res | Should -Be $true + } It "Create new shared store and skipt certificate linking" { - if (! $isLinux) { - { New-CredentialStore -Shared -UseCertStore -Force } | Should -Not -Throw - $CS = Get-CredentialStore -Shared - $CS.PfxCertificate | Should -Be $null - $CS.Thumbprint | Should -Not -Be $null - } - else { - { New-CredentialStore -Shared -UseCertStore -Force } | Should -Throw - } + { New-CredentialStore -Shared -UseCertStore -Force } | Should -Not -Throw + $CS = Get-CredentialStore -Shared + $CS.PfxCertificate | Should -Be $null + $CS.Thumbprint | Should -Not -Be $null + Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation CurrentUser + Write-Verbose -Message ('res: {0}' -f $res) -Verbose + $res | Should -Be $true } } }