On Wednesday, March 28, 2012 1:28:56 AM UTC-6, rudyryk wrote:
Hello, Jonathan!--I think issue is in the fragment 'password=user.password' in the line:
> response = self.client.login(username=
user.username,
> password=user.password)'user.password' - is not plain text password, it's encrypted and it's
not equal 't3stp@s$' !Alexey rudyryk
///On Wed, Mar 28, 2012 at 10:05 AM, jondbaker
<jonathandavidbaker@gmail.com> 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 True
>
> tests.py
> from django.test import TestCase
> from django.test.client import Client
> from django.contrib.auth.models import User
>
> class 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/-/ .5zI85qKS4acJ
> 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 .
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/-/-urgiz-8OQwJ.
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