From aa9c4a60631cfe3994e2fa909b1e891dc8dbe260 Mon Sep 17 00:00:00 2001 From: Jaap Roes Date: Thu, 16 Mar 2017 16:03:43 +0100 Subject: [PATCH] User.is_authenticated is a property from Django 1.10 and onward --- sample_project/app/tests.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sample_project/app/tests.py b/sample_project/app/tests.py index 3dd3b7c..0278331 100644 --- a/sample_project/app/tests.py +++ b/sample_project/app/tests.py @@ -6,6 +6,8 @@ except ImportError: import json import uuid +import django + from django.contrib.auth.models import User from django.db import models from django.test import TestCase @@ -73,8 +75,12 @@ class SortableTestCase(TestCase): return category def test_new_user_is_authenticated(self): - self.assertEqual(self.user.is_authenticated(), True, - 'User is not authenticated') + if django.VERSION < (1, 10): + self.assertEqual(self.user.is_authenticated(), True, + 'User is not authenticated') + else: + self.assertEqual(self.user.is_authenticated, True, + 'User is not authenticated') def test_new_user_is_staff(self): self.assertEqual(self.user.is_staff, True, 'User is not staff')