1 from django.contrib.auth.models import User
2 from django.test import TestCase
4 class LongerUsernameTests(TestCase):
6 Unit tests for longerusername app
10 creates a user with a terribly long username
12 long_username = ''.join([str(i) for i in range(100)])
13 self.user = User.objects.create_user('test' + long_username, 'test@test.com', 'testpassword')
14 def testUserCreation(self):
16 tests that self.user was successfully saved, and can be retrieved
18 self.assertNotEqual(self.user,None)
19 User.objects.get(id=self.user.id) # returns DoesNotExist error if the user wasn't created