def set_password(self, raw_password): """Sets the user's password - always use this rather than directly assigning to :attr:`~mongoengine.django.auth.User.password` as the password is hashed before storage. """ self.password = make_password(raw_password) self.save() return self
def test_hash(): password = '******' hashed = make_password(password) assert hashed != password