testing function with PSCredential parameter

Welcome Forums Pester testing function with PSCredential parameter

Viewing 1 reply thread
  • Author
    Posts
    • #69978
      Participant
      Topics: 4
      Replies: 6
      Points: 41
      Rank: Member

      Hi,

      I have the function Test-InvokeVMScript. The function simply returns true or false based on the success of Invoke-VMScript. The function has two params “[string]System”, and “[PSCredential]Credential”. I am having issues specifying a dummy credential to “[PSCredential]Credential” in my test. When I run Invoke-Pester and my Test-InvokeVMScript describe block runs I am prompted for credentials. Below is the function and the test.

      Adam Bertram., now is your chance for the $5!

      https://gist.github.com/joeypiccola/3ec632dbce20bb0eb9601b4f29ea5194

      Thanks,
      Joey

    • #69984
      Participant
      Topics: 4
      Replies: 6
      Points: 41
      Rank: Member

      Well, now it works. I swear I changed nothing. I’ve even taken gist and compared it to the code that now works, identical. Also taken the gist and copied it back into my module, now ti works. No clue why.

Viewing 1 reply thread
  • The topic ‘testing function with PSCredential parameter’ is closed to new replies.