示例#1
0
文件: db.py 项目: jhsi/tymdrop
 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']))
示例#2
0
文件: db.py 项目: jhsi/tymdrop
 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']))