Enables pipeline input for -Credential parameter (#25)

This commit is contained in:
2018-03-21 14:32:32 +01:00
committed by GitHub
parent 8d55f2d6fd
commit c0b13052b3
16 changed files with 79 additions and 82 deletions

View File

@ -98,5 +98,16 @@ Describe "New-CredentialStoreItem" {
{ New-CredentialStoreItem -Path 'C:\missingStore.json' -RemoteHost 'notrelevant' } | Should -Throw "Could not add anything"
}
}
Context "Testing pipeline paramter" {
It "Add the item with credential value from pipe" {
$UserName = 'pipeUser'
$Password = ConvertTo-SecureString -String "pipePasswd" -AsPlainText -Force
{ [PSCredential]::new($UserName, $Password) | New-CredentialStoreItem -RemoteHost 'PipeHost' } | Should -Not -Throw
}
It "Testing written item" {
(Get-CredentialStoreItem -RemoteHost 'PipeHost').UserName | Should -Be 'pipeUser'
}
}
}