示例#1
0
 def test_none_pw_login(self):
     data = {"mobilephone": "18688773467", "pwd": ""}
     res = HttpRequest().http_request(self.login_url, data, "post")
     try:
         self.assertEquals('20111', res.json()["code"])
     except AssertionError as e:
         print("test_none_pw_login错误是{0}".format(e))
         raise e
示例#2
0
 def test_correct_login(self):
     data = {"mobilephone": "18688773467", "pwd": "123456"}
     res = HttpRequest().http_request(self.login_url, data, "post")
     try:  #抓取错误  异常处理
         self.assertEquals('10001', res.json()["code"])  #断言
         # self.assertIn("登陆成功", res.json()["msg"])
     except AssertionError as e:
         print("test_correct_login错误是{0}".format(e))
         raise e  #异常处理之后需要抛出去
示例#3
0
 def test_recharge_negative(self):
     recharge_data = {"mobilephone": "18688773467", "amount": "-1000"}
     recharge_res = HttpRequest().http_request(self.recharge_url,
                                               recharge_data, 'post',
                                               self.cookies)
     try:
         self.assertEquals('20117', recharge_res.json()["code"])
     except AssertionError as e:
         print("test_recharge_negative错误是{0}".format(e))
         raise e
示例#4
0
 def test_recharge_normal(self):
     recharge_data = {"mobilephone": "18688773467", "amount": "1000"}
     recharge_res = HttpRequest().http_request(self.recharge_url,
                                               recharge_data, 'post',
                                               getattr(GetData, 'cookie'))
     try:
         self.assertEquals('10001', recharge_res.json()["code"])
     except AssertionError as e:
         print("test_recharge_normal错误是{0}".format(e))
         raise e
示例#5
0
 def setUp(self):
     print("开始进行测试了")
     self.login_url = "http://119.23.241.154:8080/futureloan/mvc/api/member/login"
     self.login_data = {"mobilephone": "18688773467", "pwd": "123456"}
     self.recharge_url = ' http://119. 23. 241. 154:8080/futureloan/mvc/api/member/recharge'
     self.cookies = HttpRequest().http_request(self.login_url,
                                               self.login_data,
                                               "post").cookies
     print("登录后的cookie是:".format(self.cookies))