Commit 8bca5483aeb2179c4cd570df531a414b84e251c3

Authored by lixi
1 parent 24528d16

更新进门称重列表的case

testcase/CZFW/test_weightBizBill_listPage.py
... ... @@ -2,6 +2,7 @@
2 2 # -*- coding: UTF-8 -*-
3 3 import unittest
4 4 import urllib3
  5 +import time
5 6 from commons import common as com
6 7 from commons.MySession import my,sy1
7 8 from commons.api.weightBizBill_listPage import weightBizBill_listPage
... ... @@ -16,14 +17,18 @@ ca=listCarType(sy1)
16 17 class test_weightBizBill_listPage(unittest.TestCase):
17 18 "称重服务单列表"
18 19  
19   -
20 20 def setUp(self):
21 21 "数据准备:新增一条称重单"
  22 + #获取当前时间
  23 + self.time=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  24 + #新增数据
22 25 body=ad.body.copy()
23 26 body["carTypeId"]=ca.car_list()["data"][0]["id"]
24 27 body["carTypeName"]=ca.car_list()["data"][0]["carTypeName"]
25 28 body["carTypeCode"]=ca.car_list()["data"][0]["code"]
26 29 self.re=sy1.post(url=ad.url,headers=ad.header,json=body)
  30 + #刷新防重码
  31 + ad.refresh_commit_token()
27 32  
28 33 @unittest.case_mark(my.mark())
29 34 def test_weightBizBill_listPage_01(self):
... ... @@ -37,6 +42,18 @@ class test_weightBizBill_listPage(unittest.TestCase):
37 42 self.assertTrue("'total':1" in str(re.json()).replace(" ",""))
38 43 self.assertTrue(self.re.json()["data"]["number"] in str(re.json()).replace(" ",""))
39 44  
  45 + @unittest.case_mark(my.mark())
  46 + def test_weightBizBill_listPage_02(self):
  47 + "称重服务单列表-查询:查询条件为“车号”,其余查询条件输入合法值,查询一条指定数据"
  48 + body=bi.body.replace("attr=number","attr=plate").replace(
  49 + "202108030900001","{}".format(ad.body["plate"])).replace(
  50 + "2020-08-03 00:00:00","{}".format(self.time))
  51 + re=sy1.post(url=bi.url,headers=bi.header,data=body.encode('utf-8'))
  52 + print(re.json())
  53 + self.assertEqual(re.status_code, 200)
  54 + self.assertTrue("'total':1" in str(re.json()).replace(" ",""))
  55 + self.assertTrue(ad.body["plate"] in str(re.json()).replace(" ",""))
  56 +
40 57  
41 58 if __name__ == "__main__":
42 59  
... ...