Writing new unit tests to improve the tests' code coverage

Our first round of unit tests was related to the drone category class-based views: DroneCategoryList and DroneCategoryDetail. Now, we will write a second round of unit tests related to the pilot class-based views: PilotList and PilotDetail. The new tests will be a bit more complex because we will have to work with authenticated requests.

In Chapter 17, Securing the API with Authentication and Permissions, we configured authentication and permission policies for the class-based views that work with the Pilot model. We overrode the values for the authentication_classes and permission_classes class attributes for the PilotDetail and PilotList classes. In order to create, read, update, ...

Get Learn Web Development with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.