Skip to content

Pester Tests Should Mock API Calls #1

@cofonseca

Description

@cofonseca

Due to the current design of the Pester tests, each of the functions is actually being executed live during the test. For example, running a test against New-HipchatUser will actually create a new user in your HipChat environment. The test will then run Remove-HipchatUser to clean up after itself.

I would like to investigate somehow mocking a properly structured API response from Invoke-WebRequest, to ensure that functions aren't actually making changes to the environment. After all, we want to test the code itself, not the API.

I can't quite figure out how to structure the response correctly.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions