fix syntax error

This commit is contained in:
OCram85 2018-03-14 13:22:17 +01:00
parent b5aff1f45b
commit 82da4dc20a
1 changed files with 21 additions and 21 deletions

View File

@ -73,29 +73,29 @@ Describe "New-CredentialStoreItem" {
}
}
Context "Test optional parameter lookup" {
$UserName = 'myUser'
$Password = ConvertTo-SecureString -String "mypasswd" -AsPlainText -Force
Mock Get-Credential {
return [PSCustomObject]@{
UserName = 'myUser'
Password = ConvertTo-SecureString -String "mypasswd" -AsPlainText -Force
}
}
It "Test missing Credential" {
$tmpCS = 'C:\CredentialStore.json'
New-CredentialStoreItem -Path $tmpCs -Shared -RemoteHost 'foobar3'
$writtenItem = Get-CredentialStoreItem -Path $tmpCS -Shared -RemoteHost 'foobar3'
$writtenItem.UserName | Should -Be "myUser"
return [PSCredential]::new($UserName, $Password)
}
}
Context "General Exception handling" {
Mock Test-CredentialStore {return $false}
Mock Get-Credential {
return [PSCustomObject]@{
UserName = 'myUser'
Password = ConvertTo-SecureString -String "mypasswd" -AsPlainText -Force
}
}
It "Missing CredentialStore should throw" {
New-CredentialStoreItem -Path 'C:\missingStore.json' -RemoteHost 'notrelevant' | Should -Throw "Could not add anything"
}
It "Test missing Credential" {
$tmpCS = 'C:\CredentialStore.json'
New-CredentialStoreItem -Path $tmpCs -Shared -RemoteHost 'foobar3'
$writtenItem = Get-CredentialStoreItem -Path $tmpCS -Shared -RemoteHost 'foobar3'
$writtenItem.UserName | Should -Be "myUser"
}
}
Context "General Exception handling" {
Mock Test-CredentialStore {return $false}
$UserName = 'myUser'
$Password = ConvertTo-SecureString -String "mypasswd" -AsPlainText -Force
Mock Get-Credential {
return [PSCredential]::new($UserName, $Password)
}
It "Missing CredentialStore should throw" {
New-CredentialStoreItem -Path 'C:\missingStore.json' -RemoteHost 'notrelevant' | Should -Throw "Could not add anything"
}
}