Ask HN: How do you mock a 3rd party REST server?
1 comments
If you've built a wrapper around the integration in your application logic -- such that handling the actual HTTP requests has been abstracted away from the rest of your application -- then you can use a mocking framework (like Mockito for Java) directly in the unit tests. If you haven't, or want higher-level / isolated integration testing, you can create a mock application that mimics GitHub's API, put it in a Docker container, and use a docker-compose.yml during testing to quickly spin up your new test environment.
I'm making a github integration, so I rely on github's rest api on my backend.
I wonder how I can do unit tests for my backend by mocking github's api?
What method do you recommend?
Thanks