Esempio n. 1
0
 def test_user_login_normal(self):
     # url = 'http://115.28.108.130:5000/api/user/login/'
     # data = {"name": "张三", "password": "******"}
     # res = requests.post(url=url, data=data)
     # self.assertIn("登录成功", res.text)
     case_data = load_data.get_case(self.sheet, "test_user_login_normal")
     url = case_data[2]
     data = json.loads(case_data[3])
     res = requests.post(url=url, data=data)
     case_log("test_user_login_normal", url, case_data[3], case_data[4],
              res.text)
Esempio n. 2
0
 def test_no_page(self):
     data = readexceldata.get_test_data("test_no_page", self.data_list)
     case_log.case_log(data)
     url = data["url"]
     input_args = eval(data["input_args"])
     expire_result = data["expire_result"]
     # response=requests.post(url,data=input_args)
     response = requests.post(url, data=input_args)
     logger.info("响应内容:%s" % response)
     print(response.text)
     self.assertIn("成功", response.text)
Esempio n. 3
0
    def post_model(self, c1, c2):
        """post 请求类型"""
        data = readexceldata.get_test_data(c1, c2)
        case_log.case_log(data)
        url = data['url']
        input_payload = eval(data['input_payload'])
        expire_result = int(data['expire_result'])
        r = requests.post(url, data=input_payload, headers=wanHeader())

        logging.info("响应内容:%s" % r.text)
        result = r.json()['code']
        self.assertEqual(result, expire_result)
Esempio n. 4
0
    def get_model(self, c1, c2):
        """get请求类型"""
        data = readexceldata.get_test_data(c1, c2)
        case_log.case_log(data)
        url = data['url']
        expire_result = int(data['expire_result'])

        # # input_payload = eval(data['input_payload'])
        # r = requests.post(url,data=input_payload,headers=wanHeader())
        params = {'token': getToken(), 'sign': '123456'}
        r = requests.get(url, params)

        logging.info("响应内容:%s" % r.text)
        result = int(r.json()['code'])
        self.assertEqual(result, expire_result)
Esempio n. 5
0
 def test_city_not_exist(self):
     data = readexceldata.get_test_data("test_city_not_exist",
                                        self.data_list)
     print(data)
     case_log.case_log(data)
     url = data["url"]
     # input_args=data["input_args"]
     input_args = eval(data["input_args"])
     # print(type(input_args),input_args)
     expire_result = data["expire_result"]
     # response=requests.post(url,data=input_args)
     response = requests.post(url, data=input_args)
     logger.info("响应内容:%s" % response)
     print(response.text)
     self.assertIn("城市错误或不支持", response.text)
Esempio n. 6
0
    def test_05delSupplierBeginningBalance(self):
        """删除客户期初应收余额"""

        import requests
        from lib.read_login import getToken

        url = 'http://glterp.taijierp.cn/system/SupplierBalance/getSupplierBeginningBalanceList'
        params = {'token': getToken(), 'sign': '123456'}
        r = requests.get(url, params)
        print(r.json()['data']['data'][0]['beginning_supplier_balance_id'])
        ee = str(r.json()['data']['data'][0]['beginning_supplier_balance_id'])
        print(ee, type(ee))
        # print(r.text)
        from lib import readexceldata, case_log
        import logging
        import requests
        from lib.read_login import wanHeader

        data = readexceldata.get_test_data('delSupplierBeginningBalance',
                                           read_excel('system'))
        case_log.case_log(data)
        url = data['url']
        # input_payload = eval(data['input_payload'])
        expire_result = int(data['expire_result'])

        payload = eval(data['input_payload'])
        print(payload, type(payload))
        payload['beginning_supplier_balance_id'] = str(ee)
        input_payload = payload

        print(input_payload)
        r = requests.post(url, data=input_payload, headers=wanHeader())

        logging.info("响应内容:%s" % r.text)
        result = r.json()['code']
        self.assertEqual(result, expire_result)