Ticket #13914: tests.diff
File tests.diff, 2.1 KB (added by , 14 years ago) |
---|
-
django/contrib/auth/tests/__init__.py
4 4 from django.contrib.auth.tests.forms import UserCreationFormTest, AuthenticationFormTest, SetPasswordFormTest, PasswordChangeFormTest, UserChangeFormTest, PasswordResetFormTest 5 5 from django.contrib.auth.tests.remote_user \ 6 6 import RemoteUserTest, RemoteUserNoCreateTest, RemoteUserCustomTest 7 from django.contrib.auth.tests.models import ProfileTestCase 7 from django.contrib.auth.tests.models import ProfileTestCase, NaturalKeysTestCase 8 8 from django.contrib.auth.tests.tokens import TokenGeneratorTest 9 9 from django.contrib.auth.tests.views \ 10 10 import PasswordResetTest, ChangePasswordTest, LoginTest, LogoutTest -
django/contrib/auth/tests/models.py
1 1 from django.conf import settings 2 2 from django.test import TestCase 3 from django.contrib.auth.models import User, SiteProfileNotAvailable3 from django.contrib.auth.models import Group, User, SiteProfileNotAvailable 4 4 5 5 class ProfileTestCase(TestCase): 6 6 fixtures = ['authtestdata.json'] … … 33 33 # module that doesn't exist 34 34 settings.AUTH_PROFILE_MODULE = 'foo.bar' 35 35 self.assertRaises(SiteProfileNotAvailable, user.get_profile) 36 37 38 class NaturalKeysTestCase(TestCase): 39 fixtures = ['authtestdata.json'] 40 def test_user_natural_key(self): 41 staff_user = User.objects.get(username='staff') 42 self.assertEquals(User.objects.get_by_natural_key('staff'), staff_user) 43 self.assertEquals(staff_user.natural_key(), ('staff',)) 44 45 def test_group_natural_key(self): 46 users_group = Group.objects.create(name='users') 47 self.assertEquals(Group.objects.get_by_natural_key('users'), users_group) 48 self.assertEquals(users_group.natural_key(), ('users',))