From c46e3f5c534917a7e416f171cf878ea225c60f34 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 14 Mar 2018 09:55:13 +0100 Subject: [PATCH] adds New-CredentialStoreItem test with remotehost + identifier test --- tests/Item/02_New-CredentialStoreItem.Tests.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Item/02_New-CredentialStoreItem.Tests.ps1 b/tests/Item/02_New-CredentialStoreItem.Tests.ps1 index f1914bb..d84c1a7 100644 --- a/tests/Item/02_New-CredentialStoreItem.Tests.ps1 +++ b/tests/Item/02_New-CredentialStoreItem.Tests.ps1 @@ -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 + } } }