Assert-MockCalled Not catching specific call

Welcome Forums Pester Assert-MockCalled Not catching specific call

Viewing 0 reply threads
  • Author
    Posts
    • #173854
      Participant
      Topics: 1
      Replies: 0
      Points: 13
      Rank: Member

      I have the following code and test (snippets from https://github.com/sjlouder/Lastpass-PS/blob/Duo/Tests/Lastpass.Tests.ps1#L291 and https://github.com/sjlouder/Lastpass-PS/blob/Duo/Lastpass/Lastpass.psm1#L164):

      https://gist.github.com/sjlouder/75761dcdfc82ca95d9920c3c9dfd7160

      The workflow is trying to authenticate normally, then receiving an XML response with an error element and information stating it needs to use out-of-band, and proceeded to check the OOB endpoint for verification.

      The test that fails is “It Attempts to log in normally ” where it checks that a call was made to the login endpoint without the outofbandrequest parameter in the body. However, I modified the mock to write the body contents to the console so I know the mock was triggered and that the body does not contain the ouofbandrequest key (seen here ). It also passes if only one of the checks in the parameterfilter are specified (the $URI or the $Body.containskey()), but fails when both are specified.

      This fails locally on my laptop (running Fedora 28 or 29) as well in CI so it may be related to running on linux, but I would not expect that to cause any issues.

      Would appreciate any help with troubleshooting why it’s failing. I imagine I am missing something simple, but I haven’t made any progress.

Viewing 0 reply threads
  • The topic ‘Assert-MockCalled Not catching specific call’ is closed to new replies.