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 8, 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, or delete pilots, we have to provide an authentication token. Hence, we will write tests to make sure that an unauthenticated request cannot...