adds New-CredentialStoreItem test with remotehost + identifier test

This commit is contained in:
OCram85 2018-03-14 09:55:13 +01:00
parent ebd0b79080
commit c46e3f5c53

View File

@ -61,5 +61,15 @@ Describe "New-CredentialStoreItem" {
$res = Get-Member -InputObject $tmpCS -Name $RemoteHost -Membertype Properties
$res.Name | Should Be $RemoteHost
}
It "Adds Item with identifier to shared store" {
$tmpCS = 'C:\CredentialStore.json'
$UserName = "myuser"
$Password = ConvertTo-SecureString -String "mypasswd" -AsPlainText -Force
$mycreds = New-Object -TypeName PSCredential -ArgumentList $UserName, $Password
$RemoteHost = "foobar2"
New-CredentialStoreItem -Path $tmpCS -RemoteHost $RemoteHost -Credential $mycreds -Identifier 'Foo'
$writtenItem = Get-CredentialStoreItem -Path $tmpCS -RemoteHost $RemoteHost -Identifier 'Foo'
($writtenItem.UserName -eq $UserName) -and ($writtenItem.Password.Length -gt 0) | Should -Be $true
}
}
}