Marco Blessing
fdc6651588
## About ## Content (Micro Commits) * fixes #38 * fixes #44 * Implement precise lookup hierarchy (fixes #43) * align pester test with #43 logic * split cert functions * use new cert functions for save an lookup * fix pester tests * [wip] * fix var name ref * fix exports * fix cert store location for windows shared mode * fix mandatory params * fix accidentially removed code block * add basic cert pester pests * remove old docs * update cbh blocks * update cbh blocks * update docs * move .net wrapper forpfx files * do not export .net wrapper functions * update docs * rename tests * fix private functions location * - fixes #44: FTP connection * add link to reference * add format files * add preview version shield * update markdown help files (platyps) * add emoji images in captions * fix typos * fix typos * fix typo * prepare version numbers
33 lines
1.6 KiB
PowerShell
33 lines
1.6 KiB
PowerShell
$RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName'
|
|
|
|
Describe "Get-CredentialStore" {
|
|
Context "Basic logic tests" {
|
|
$TestCredentialStore = Join-Path -Path $RepoRoot -ChildPath 'resources/cs/CredentialStore.json'
|
|
$TestPfxCert = Join-Path -Path $RepoRoot -ChildPath 'resources/cs/PSCredentialStore.pfx'
|
|
'TestCredentialStore: {0}' -f $TestCredentialStore
|
|
It "Test1: Read CS without params" {
|
|
if (! (Test-Path -Path (Get-DefaultCredentialStorePath)) ) {
|
|
{ New-CredentialStore -Force } | Should -Not -Throw
|
|
|
|
}
|
|
{ Get-CredentialStore } | Should -Not -Throw
|
|
}
|
|
It "Test2: Read Credential Store with testing data" {
|
|
{ Use-CSCertificate -Shared -CredentialStore $TestCredentialStore -Path $TestPfxCert } | Should -Not -Throw
|
|
{ Get-CredentialStore -Shared -Path $TestCredentialStore } | Should -Not -Throw
|
|
}
|
|
It "Test3: Not existing path should return false" {
|
|
{ Get-CredentialStore -Shared -Path './CredentialStore.json' } | Should -Throw "Could not find the CredentialStore."
|
|
}
|
|
}
|
|
Context "Testing invalid json data" {
|
|
#Mock Test-CredentialStore {return $true}
|
|
#Mock Get-Content {return '"foo":"bar",'}
|
|
$BrokenCS = Join-Path -Path $RepoRoot -ChildPath 'resources/cs/Broken_CS.json'
|
|
Write-Verbose -Message ('BrokenCS Path: {0}' -f $BrokenCS) -Verbose
|
|
It "Should throw with invalid CredentialStore" {
|
|
{ Get-CredentialStore -Path -Shared $BrokenCS } | Should -Throw
|
|
}
|
|
}
|
|
}
|