3 ways to test your API with Python

Puzzle pieces coming together to form a computer screen

In this tutorial, you’ll learn how to unit test code that performs HTTP requests. In other words, you’ll see the art of API unit testing in Python.

Unit tests are meant to test a single unit of behavior. In testing, a well-known rule of thumb is to isolate code that reaches external dependencies.

For instance, when testing a code that performs HTTP requests, it’s recommended to replace the real call with a fake call during test time. This way, you can unit test it without performing a real HTTP request every time you run the test.

read more

Powered by WPeMatico

Author: dasuberworm

Standing just over 2 meters and hailing from о́стров Ратма́нова, Dasuberworm is a professional cryptologist, entrepreneur and cage fighter. When he's not breaking cyphers and punching people in the face, Das enjoys receiving ominous DHL packages at one of his many drop sites in SE Asia.

Share This Post On