Publish preview version #42

Merged
OCram85 merged 25 commits from dev into master 2019-04-04 17:02:18 +02:00
Showing only changes of commit 3ab629d17d - Show all commits

View File

@ -81,5 +81,25 @@ Describe "New-CredentialStoreItem" {
(Get-CredentialStoreItem -RemoteHost 'PipeHost').UserName | Should -Be 'pipeUser'
}
}
Context "Testing items with certficiate store" {
It "Create item in new store with cert store link" {
{ New-CredentialStore -UseCertStore -Force } | Should -Not -Throw
$Path = Get-DefaultCredentialStorePath
$StoreHome = Split-Path -Path $Path -Parent
$CertFile = Join-Path -Path $StoreHome -ChildPath 'PSCredentialStore.pfx'
certutil.exe -Importpfx -user MY $CertFile "NoProtect, NoRoot"
function global:Get-Credential ([string]$Message) {
$UserName = 'testuser'
$Password = ConvertTo-SecureString -String "mypasswd" -AsPlainText -Force
return [PSCredential]::new($UserName, $Password)
}
New-CredentialStoreItem -RemoteHost 'foobarcerts'
Remove-Item -Path 'Function:\Get-Credential'
$writtenItem = Get-CredentialStoreItem -Path $tmpCS -Shared -RemoteHost 'foobarcerts'
$writtenItem.UserName | Should -Be "testuser"
$writtenItem.GetNetworkCredential().Password | Should -Be 'mypasswd'
}
}
}