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)
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)
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)
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)
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)