Пример #1
0
 def test_login_user_error1(self):
     # 1.准备测试数据
     # 参数
     data = {"username": "******", "password1": "123456", "password2": "123456"}
     # 预期结果
     expected = {"code": 0, "msg": "账号和密码必须在6-18位之间"}
     # 2.获取实际结果
     res = login_test.register(**data)
     # 3.断言
     self.assertEqual(expected, res)
Пример #2
0
 def test_login_user_is_exist(self):
     # 1.准备测试数据
     # 参数
     data = {"username": "******", "password1": "123456", "password2": "123456"}
     # 预期结果
     expected = {"code": 0, "msg": "该账户已存在"}
     # 2.获取实际结果
     res = login_test.register(**data)
     # 3.断言
     self.assertEqual(expected, res)
Пример #3
0
 def test_login_pwd2_error(self):
     # 1.准备测试数据
     # 参数
     data = {"username": "******", "password1": "123456", "password2": "123457"}
     # 预期结果
     expected = {"code": 0, "msg": "两次密码不一致"}
     # 2.获取实际结果
     res = login_test.register(**data)
     # 3.断言
     self.assertEqual(expected, res)
Пример #4
0
 def test_login_pass(self):
     # 1.准备测试数据
     # 参数
     data = {"username": "******", "password1": "123456", "password2": "123456"}
     # 预期结果
     expected = {"code": 1, "msg": "注册成功"}
     # 2.获取实际结果
     res = login_test.register(**data)
     # 3.断言
     self.assertEqual(expected, res)
Пример #5
0
 def test_login_pwd2_is_none(self):
     # 1.准备测试数据
     # 参数
     data = {"username": "******", "password1": "123456", "password2": None}
     # 预期结果
     expected = {"code": 0, "msg": "所有参数不能为空"}
     # 2.获取实际结果
     res = login_test.register(**data)
     # 3.断言
     self.assertEqual(expected, res)