On Wednesday, March 28, 2012 12:05:49 AM UTC-6, jondbaker wrote:
I'm trying to write a unit test that will verify that the login form authenticates a user. Whenever I run 'manage.py test' the runner fails with this message:--AssertionError: False is not Truetests.pyfrom django.test import TestCasefrom django.test.client import Clientfrom django.contrib.auth.models import Userclass TestAccountLogin(TestCase):def setUp(self):self.client = Client()def test_login(self):user = User.objects.create_user('test', 'test@test.com', 't3stp@s$') response = self.client.login(username=user.username, password=user.password) self.assertTrue(response)After creating the user, I can verify that user.is_active is in fact True, but unfortunately response returns False. Both 'django.contrib.auth.middleware. AuthenticationMiddleware' and 'django.contrib.auth' are declared in settings.py. Any thoughts?
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/6PqfFCkJUz0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment