I want to run a unit test for a user logging in but I get error.  What am I 
doing wrong?


from django.test import TestCase
from userprofile.models import UserProfile
from django.contrib.auth.models import User

class UserProfileTest(TestCase):
    # User factory method
    def create_user(self, username='joe', password='joe'):
        return User.objects.create(username=username, password=password)

    # Create User
    def test_creation_USER(self):
        u = self.create_user()
        self.assertTrue(isinstance(u, User))
        login = self.client.login(username='joe', password='joe')
*        self.assertEqual(login, True)*

======================================================================
FAIL: test_creation_USER (userprofile.tests.UserProfileTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/Django/project/userprofile/tests.py", line 44, in 
test_creation_USER
    self.assertEqual(login, True)
*AssertionError: False != True*

----------------------------------------------------------------------


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5d49c776-fe1f-4702-abc1-d2c99468d82a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to