User.is_authenticated is a property from Django 1.10 and onward

master
Jaap Roes 2017-03-16 16:03:43 +01:00
parent a5eca5ea4d
commit aa9c4a6063
1 changed files with 8 additions and 2 deletions

View File

@ -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')