Marco Blessing
3d90d912ee
All checks were successful
continuous-integration/drone/push Build is passing
#### 📖 Summary <!-- Provide a summary of your changes. Describe the why and not how. --> #### 📑 Test Plan > 💡 Select your test plan for the code changes. - [x] Tested via Drone.io pipeline - [ ] Custom test - [ ] No test plan ##### Details / Justification <!-- Add your test details or justification for missing tests here. --> #### 📚 Additional Notes <!-- A place for additional detail notes. --> Co-authored-by: OCram85 <marco.blessing@googlemail.com> Reviewed-on: #62
46 lines
1.7 KiB
PowerShell
46 lines
1.7 KiB
PowerShell
BeforeAll {
|
|
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
|
Import-Module $ManifestFile -Force
|
|
|
|
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
|
$_.BaseName -notmatch '.Tests'
|
|
}
|
|
).FullName
|
|
foreach ( $func in $PrivateFunctions) {
|
|
. $func
|
|
}
|
|
}
|
|
|
|
Describe "Get-CredentialStore" {
|
|
Context "Basic logic tests" {
|
|
It "Read CS without params" {
|
|
if (! (Test-Path -Path (Get-DefaultCredentialStorePath)) ) {
|
|
{ New-CredentialStore -Force } | Should -Not -Throw
|
|
}
|
|
{ Get-CredentialStore } | Should -Not -Throw
|
|
}
|
|
It "Read Credential Store with testing data" {
|
|
$TestCredentialStore = './resources/cs/CredentialStore.json'
|
|
$TestPfxCert = './resources/cs/PSCredentialStore.pfx'
|
|
{
|
|
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" {
|
|
It "Should throw with invalid CredentialStore" {
|
|
$BrokenCS = './resources/cs/Broken_CS.json'
|
|
Write-Verbose -Message ('BrokenCS Path: {0}' -f $BrokenCS) -Verbose
|
|
{
|
|
Get-CredentialStore -Path -Shared $BrokenCS
|
|
} | Should -Throw
|
|
}
|
|
}
|
|
}
|