          credentials = basic_auth_header('username', 'password')
          self.request = factory.get('/1', format='json', HTTP_AUTHORIZATION=credentials)
          self.custom_message = 'Custom: You cannot access this resource'
  
      def test_permission_denied(self):
          response = denied_view(self.request, pk=1)
          detail = response.data.get('detail')
          self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
          self.assertNotEqual(detail, self.custom_message)
 
</s>
        self.custom_code = 'permission_denied_custom'
          credentials = basic_auth_header('username', 'password')
          self.request = factory.get('/1', format='json', HTTP_AUTHORIZATION=credentials)
          self.custom_message = 'Custom: You cannot access this resource'
        self.custom_code = 'permission_denied_custom'
  
      def test_permission_denied(self):
          response = denied_view(self.request, pk=1)
          detail = response.data.get('detail')
          self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
          self.assertNotEqual(detail, self.custom_message)
keep keep add keep keep keep keep keep keep
 Pass custom code to PermissionDenied if permission class had one set (#7306)
tests/test_permissions.py