5👍
✅
You can not create a User
object with a password like that. The password needs to be hashed. Therefore, you should use the .set_password(..)
method [Django-doc]:
class UserTestCase(TestCase):
def setUp(self):
self.testu = User(username="thename", first_name="thefirstname")
self.testu.set_password("thepassword")
self.testu.save()
# …
Source:stackexchange.com