def test_password_gl18(self): # 预期结果 excepted = {"code": 1, "msg": "密码长度必须在6-18位之间"} # 参数 data = ("python18", "lemonbanlemonbanlemonban") # 调用被测的功能函数,传入参数,获取实际结果 res = login_check(*data) try: self.assertEqual(excepted, res) except AssertionError as e: print("该用例测试未通过") raise e else: print("测试通过")
def test_username_error(self): # 预期结果 excepted = {"code": 1, "msg": "账号或密码不正确"} # 参数 data = ("python", "lemonban") # 调用被测的功能函数,传入参数,获取实际结果 res = login_check(*data) try: self.assertEqual(excepted, res) except AssertionError as e: print("该用例测试未通过") raise e else: print("测试通过")