[Answer]-Writing a unit test for a DJANGO view

1👍

The Django testing tutorial has sample code for verifying the 200 vs. 404 return codes as well as checking that the response contains a particular string, so you should start with that.

Also, you might want to mock out the requests library with Mox so that you’re not making actual HTTP requests to those services. This technique is known as dependency injection (see Wikipedia, SO, and Martin Fowler for more info).

Leave a comment