def test_has_permission_with_view_kwargs_as_non_owner(self): """ Non-owners should not have permission. """ user = UserFactory() self.request.user = user view = GenericAPIView() view.kwargs = {'username': UserFactory().username} self.assertFalse(self.permission.has_permission(self.request, view))
def test_has_permission_with_view_kwargs_as_owner_with_get(self): """ Owners always have permission to make GET actions. """ user = UserFactory() self.request.user = user view = GenericAPIView() view.kwargs = {'username': user.username} self.assertTrue(self.permission.has_permission(self.request, view))