Exemple #1
0
 def test_login_wrong_pwd(self):
     data = {"mobilephone": "1310000000", "pwd": "123456789"}
     res = HttpRequest().http_request(self.login_url, data, 'get')
     try:
         self.assertEquals("20111", res.json()["code"])
     except AssertionError as e:
         print("test_login_normal's error is{}".format(e))
         raise e
Exemple #2
0
 def test_recharge_negative(self):
     recharge_data = {"mobilephone": "18688773467", "amount": "-1000"}
     res = HttpRequest().http_request(self.recharge_url, recharge_data,
                                      'post', self.cookies)
     try:
         self.assertEquals("20117", res.json()["code"])
     except AssertionError as e:
         print("test_recharge_normal's error is{}".format(e))
         raise e
Exemple #3
0
 def test_recharge_normal(self):
     global COOKIE
     recharge_data = {"mobilephone": "18688773467", "amount": "2000"}
     res = HttpRequest().http_request(self.recharge_url, recharge_data,
                                      'post', COOKIE)
     try:
         self.assertEquals("10001", res.json()["code"])
     except AssertionError as e:
         print("test_recharge_normal's error is{}".format(e))
         raise e
Exemple #4
0
 def test_recharge_negative(self):
     # global COOKIE
     recharge_data = {"mobilephone": "18688773467", "amount": "-1000"}
     # res = HttpRequest().http_request(self.recharge_url, recharge_data, 'post',COOKIE)
     res = HttpRequest().http_request(self.recharge_url, recharge_data,
                                      'post', getattr(GetData, "Cookie"))
     try:
         self.assertEquals("20117", res.json()["code"])
     except AssertionError as e:
         print("test_recharge_normal's error is{}".format(e))
         raise e
Exemple #5
0
    def test_login_normal(self):  #正常登录
        global COOKIE  #声明全局变量
        data = {"mobilephone": "1310000000", "pwd": "123456"}
        res = HttpRequest().http_request(self.login_url, data, 'get')
        if res.cookies:  #如果cookie有的话,就更新COOKIE
            # COOKIE = res.cookies
            setattr(GetData, "Cookie")

        try:
            self.assertEquals("10001", res.json()["code"])
        except AssertionError as e:
            print("test_login_normal's error is{}".format(e))
            raise e