def test_check_password(self): with mock_user() as user: full_user = db.get_user_by_id(user['id']) self.assertTrue(db.check_password(user['password'], full_user['password_hash'])) self.assertFalse(db.check_password(random_string(10), full_user['password_hash']))
def test_change_password(self): with mock_user() as user: new_password = random_string(20) db.change_user_password( user_id=user['id'], password=new_password) full_user = db.get_user_by_id(user['id']) self.assertTrue(db.check_password(new_password, full_user['password_hash']))