I'm coding tests for an restful service (with DRF), I wanna tests that I don't must need to modify when permissions View change.
Example:
view.py
class List(generics.ListAPIView): permission_classes = (IsAuthenticated, ) queryset = List.objects.all() serializer_class = ListSerializer
test.py
def test_liste(self): url = reverse('degree-list') response = self.client.get(url) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
if run test
OK
but if permission_classes = (AllowAny, )
run test
FAILED (failures=1)
Then, How I could code the test to no must recode it when permissions change?
Thanks