Python Django测试登录失败

Python Django测试登录失败,python,django,authentication,testing,login,Python,Django,Authentication,Testing,Login,我正在尝试用Django做一些简单的测试,但是我无法成功地使用该用户登录。这是我的密码: def createUser(isadmin): u = User.objects.create_user(username="Test" + ("Admin" if isadmin else "Regular"), password="test") return u def loginUser(self, theusername, thepassword): print(the

我正在尝试用Django做一些简单的测试,但是我无法成功地使用该用户登录。这是我的密码:

def createUser(isadmin):
    u = User.objects.create_user(username="Test" + ("Admin" if isadmin else "Regular"), password="test")
    return u

def loginUser(self, theusername, thepassword):

    print(theusername + " " + thepassword)
    a = self.client.login(username = theusername, password = thepassword)
    # Prints false - should be true, right?
    print(a)
稍后的某个地方:

class DailyEntriesIntTests(TestCase):
    def setUp(self):
        self.client = Client()
        u = createUser(False)
        loginUser(self, u.username, u.password)

这难道不是我登录所需要的全部吗?

哎呀-密码被加密了-我需要传入明文密码,然后该方法正确返回“true”