[Answer]-Django user setup for nose tests

1👍

figured it out from :
http://www.pukkared.com/2011/07/simulating-user-login-in-a-django-view-unit-test/

the proper code is:

def setUp(self):
    self.client = Client()
    user = User.objects.create_user(username="test", password="test")

def testTestUser(self):
    """ Tests if the django user 'test' is setup properly."""
    noz.set_trace()
    # login the test user
    response = self.client.login(username='test', password='test')    
    noz.assert_equal(response, True)

Leave a comment