class TestOrder(TestCase): def setUp(self): self.r = HttpUtils() def tearDown(self): result = self.result self.r.logJson(jsonStr=result.text) assert result.status_code == 200, "请求状态码应为 200" def test_list(self): """订单列表接口 """ company_id = '025c647c-9281-486f-8c72-2bf18a2c1f5d' order_no = '' effective_time = '' failure_time = '' start_time = '2019-08-26' end_time = '2019-08-28' url = Order.LIST + f'?page=1&pageSize=10&companyId={company_id}&orderNo={order_no}' \ f'&effectiveTime={effective_time}&failureTime={failure_time}&startTime={start_time}&endTime={end_time}' self.result = self.r.get(url) def test_detail(self): """订单详情 """ order_id = '097b769d-f22e-4ff7-88e1-32f55d3f643d' url = Order.DETAIL + f"{order_id}?page=1&pageSize=10&type=4" self.result = self.r.get(url)
class TestAttachmentInfo(unittest.TestCase): def setUp(self): self.r = HttpUtils() pass def tearDown(self): pass def test_get(self): id = '20822da6-2c51-45b7-b88c-1c6c5b3749a2' response = self.r.get(info.get + '/' + id) self.r.logJson(jsonObj=response.json()) def addTest(self, suit): suit.addTest() return suit
class TestcompanyConfig(unittest.TestCase): def setUp(self): """ 测试用例初始化操作 """ self.r = HttpUtils() def tearDown(self): assert self.result.status_code == 200 self.r.logJson(jsonStr=self.result.text) def test_callbackConfig_insert(self): """新增企业鉴权接口配置信息 """ data = { 'companyId': '61e04cca-9213-451b-94ae-8d4dc2a1a5ea', 'callbackUrl': 'https://test9.zhixueyun.com/#/home' } self.result = self.r.post(CompanyConfig.CALLBACK_CONFIG, data=data) def test_callbackConfig_update(self): """修改企业鉴权接口配置信息 """ data = { 'companyId': '61e04cca-9213-451b-94ae-8d4dc2a1a5ea', 'callbackUrl': 'http://confluence.zhixueyun.com/pages/viewpage.action?pageId=14109785' } self.result = self.r.post(CompanyConfig.CALLBACK_CONFIG, data=data) def test_callbackConfig_get(self): """查询企业鉴权接口配置信息 """ company_id = '61e04cca-9213-451b-94ae-8d4dc2a1a5ea' url = CompanyConfig.CALLBACK_CONFIG + f'?companyId={company_id}' self.result = self.r.get(url)
def test(): r = HttpUtils() result = r.get(URL_API) print(result.text)
def repaire(url): r = HttpUtils() result = r.get(url=url) r.logJson(jsonStr=result.text)