  class PermissionsCompositionTests(TestCase):
  
  
      def test_and_false(self):
          request = factory.get('/1', format='json')
          request.user = AnonymousUser()
          composed_perm = permissions.IsAuthenticated & permissions.AllowAny
          assert composed_perm().has_permission(request, None) is False
 
</s> remove         request.user = FakeUser(auth=False)
 </s> add         request.user = AnonymousUser() </s> remove class PermissionsCompositionTests(TestCase):
 </s> add  </s> remove         request.user = FakeUser(auth=False)
 </s> add         request.user = AnonymousUser() </s> remove         request.user = FakeUser(auth=True)
 </s> add         request.user = self.user </s> remove         request.user = FakeUser(auth=True)
 </s> add         request.user = self.user
    def setUp(self):
        self.username = 'john'
        self.email = 'lennon@thebeatles.com'
        self.password = 'password'
        self.user = User.objects.create_user(
            self.username,
            self.email,
            self.password
        )
        self.client.login(username=self.username, password=self.password)
  class PermissionsCompositionTests(TestCase):
  
    def setUp(self):
        self.username = 'john'
        self.email = 'lennon@thebeatles.com'
        self.password = 'password'
        self.user = User.objects.create_user(
            self.username,
            self.email,
            self.password
        )
        self.client.login(username=self.username, password=self.password)
  
      def test_and_false(self):
          request = factory.get('/1', format='json')
          request.user = AnonymousUser()
          composed_perm = permissions.IsAuthenticated & permissions.AllowAny
          assert composed_perm().has_permission(request, None) is False
keep add keep keep keep keep keep keep
 use actual user instead of fake user in permission composition test 
tests/test_permissions.py