Commit 3bf4e02deb7eff32da4a3ac36f53a8bde638356c

Authored by lixi
1 parent 906f9edf

更新哈尔滨用例脚本

commons/api/entranceFeeBill_details.py
... ... @@ -2,7 +2,7 @@
2 2 # -*- coding: UTF-8 -*-
3 3 import urllib3
4 4 from commons import common as com
5   -from commons.MySession import sy1
  5 +from commons.MySession import sy1,heb
6 6 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
7 7  
8 8  
... ... @@ -46,6 +46,8 @@ class entranceFeeBill_details():
46 46 self.url = entranceFeeBill_details.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
47 47 self.url =self.url + entranceFeeBill_details.url_tail.replace('\n', '')
48 48 self.header = entranceFeeBill_details.header
  49 +
  50 + def sql_select(self,marketid):
49 51 self.sql="""SELECT
50 52 a.car_type_id, #0车型
51 53 b.category_id, #1品类
... ... @@ -70,8 +72,8 @@ class entranceFeeBill_details():
70 72 AND a.company_id IS NOT NULL
71 73 AND a.ic IS NOT NULL
72 74 AND a.cashier_name IS NOT NULL
73   - ORDER BY a.id DESC LIMIT 1;""".format(sy1.user["sy_user01"]["firmId"])
74   -
  75 + ORDER BY a.id DESC LIMIT 1;""".format(marketid)
  76 + return self.sql
75 77  
76 78 # tt=entranceFeeBill_details()
77 79 # re=sy1.get(url=tt.url,headers=tt.header)
... ...
commons/api/entranceFeeBill_provesPage.py
... ... @@ -29,6 +29,8 @@ class entranceFeeBill_provesPage():
29 29 self.url = entranceFeeBill_provesPage.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
30 30 self.header = entranceFeeBill_provesPage.header
31 31 self.body= entranceFeeBill_provesPage.body.replace('\n', '')
  32 +
  33 + def sql_select(self,marketid):
32 34 self.sql="""SELECT
33 35 a.dep, #部门
34 36 a.number, #收费单号
... ... @@ -52,8 +54,8 @@ class entranceFeeBill_provesPage():
52 54 AND a.company_id IS NOT NULL
53 55 AND a.ic IS NOT NULL
54 56 AND b.prove_type_code IS NOT NULL
55   - ORDER BY a.id DESC LIMIT 1;""".format(sy1.user["sy_user01"]["firmId"])
56   -
  57 + ORDER BY a.id DESC LIMIT 1;""".format(marketid)
  58 + return self.sql
57 59  
58 60 # tt=entranceFeeBill_provesPage()
59 61 # re=sy1.post(url=tt.url,headers=tt.header,data=tt.body.encode('utf-8'))
... ...
testcase/heb/CZFW/test_weightBizBill_listPage.py
... ... @@ -37,7 +37,7 @@ class test_weightBizBill_listPage(unittest.TestCase):
37 37 "称重服务单列表-查询:查询条件为“单据编号”,其余查询条件输入合法值,查询一条指定数据"
38 38 body=bi.body.replace("202108030900001",self.re.json()["data"]["number"]).replace(
39 39 "carTypeId=53","carTypeId={}".format(ca.car_list()["data"][0]["id"])).replace(
40   - "depId=139","depId={}".format(heb.user["sy_user01"]["departmentId"]))
  40 + "depId=139","depId={}".format(heb.user["heb_user01"]["departmentId"]))
41 41 re=heb.post(url=bi.url,headers=bi.header,data=body)
42 42 print(re.json())
43 43 self.assertEqual(re.status_code, 200)
... ... @@ -51,7 +51,7 @@ class test_weightBizBill_listPage(unittest.TestCase):
51 51 "202108030900001","{}".format(ad.body["plate"])).replace(
52 52 "2020-08-03 00:00:00","{}".format(self.time)).replace(
53 53 "carTypeId=53", "carTypeId={}".format(ca.car_list()["data"][0]["id"])).replace(
54   - "depId=139", "depId={}".format(heb.user["sy_user01"]["departmentId"]))
  54 + "depId=139", "depId={}".format(heb.user["heb_user01"]["departmentId"]))
55 55 re=heb.post(url=bi.url,headers=bi.header,data=body.encode('utf-8'))
56 56 print(re.json())
57 57 self.assertEqual(re.status_code, 200)
... ...
testcase/heb/entranceFeeBill_detail/test_entranceFeeBill_details.py
... ... @@ -15,7 +15,12 @@ class test_entranceFeeBill_details(unittest.TestCase):
15 15  
16 16 @classmethod
17 17 def setUpClass(cls):
18   - cls.data=db.mysql_selectOne(en.sql)
  18 + sql=en.sql_select(heb.user["heb_user01"]["firmId"])
  19 + #哈尔滨该页面没有用子公司字段
  20 + sql=sql.replace("AND a.company_id IS NOT NULL","")
  21 + print(sql)
  22 + #查询功能模块是否存在响应数据
  23 + cls.data=db.mysql_selectOne(sql)
19 24  
20 25  
21 26 @unittest.case_mark(my.mark())
... ... @@ -29,8 +34,8 @@ class test_entranceFeeBill_details(unittest.TestCase):
29 34 replace("status=4", "status={}".format(self.data[4])).\
30 35 replace("type=1", "type={}".format(self.data[5])).\
31 36 replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
32   - replace("companyId=9", "companyId={}".format(self.data[8]))
33   - re=heb.get(url=url,headers=en.header)
  37 + replace("&companyId=9","")
  38 + re=heb.get(url=url,headers=en.header,proxies=my.myproxies)
34 39 print(re.json())
35 40 self.assertEqual(re.status_code, 200)
36 41 self.assertTrue("'total':1" in str(re.json()).replace(" ",""))
... ... @@ -47,7 +52,7 @@ class test_entranceFeeBill_details(unittest.TestCase):
47 52 replace("status=4", "status={}".format(self.data[4])).\
48 53 replace("type=1", "type={}".format(self.data[5])).\
49 54 replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
50   - replace("companyId=9", "companyId={}".format(self.data[8])).\
  55 + replace("companyId=9", "").\
51 56 replace("attr=number", "attr=likePlate")
52 57 re=heb.get(url=url,headers=en.header)
53 58 print(re.json())
... ... @@ -65,7 +70,7 @@ class test_entranceFeeBill_details(unittest.TestCase):
65 70 replace("status=4", "status={}".format(self.data[4])).\
66 71 replace("type=1", "type={}".format(self.data[5])).\
67 72 replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
68   - replace("companyId=9", "companyId={}".format(self.data[8])).\
  73 + replace("companyId=9", "").\
69 74 replace("attr=number", "attr=goods")
70 75 re=heb.get(url=url,headers=en.header)
71 76 print(re.json())
... ... @@ -83,7 +88,7 @@ class test_entranceFeeBill_details(unittest.TestCase):
83 88 replace("status=4", "status={}".format(self.data[4])).\
84 89 replace("type=1", "type={}".format(self.data[5])).\
85 90 replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
86   - replace("companyId=9", "companyId={}".format(self.data[8])).\
  91 + replace("companyId=9", "").\
87 92 replace("attr=number", "attr=pay")
88 93 re=heb.get(url=url,headers=en.header)
89 94 print(re.json())
... ... @@ -101,7 +106,7 @@ class test_entranceFeeBill_details(unittest.TestCase):
101 106 replace("status=4", "status={}".format(self.data[4])).\
102 107 replace("type=1", "type={}".format(self.data[5])).\
103 108 replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
104   - replace("companyId=9", "companyId={}".format(self.data[8])).\
  109 + replace("companyId=9", "").\
105 110 replace("attr=number", "attr=cname")
106 111 re=heb.get(url=url,headers=en.header)
107 112 print(re.json())
... ... @@ -119,7 +124,7 @@ class test_entranceFeeBill_details(unittest.TestCase):
119 124 replace("status=4", "status={}".format(self.data[4])).\
120 125 replace("type=1", "type={}".format(self.data[5])).\
121 126 replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
122   - replace("companyId=9", "companyId={}".format(self.data[8])).\
  127 + replace("companyId=9", "").\
123 128 replace("attr=number", "attr=ic")
124 129 re=heb.get(url=url,headers=en.header)
125 130 print(re.json())
... ... @@ -137,7 +142,7 @@ class test_entranceFeeBill_details(unittest.TestCase):
137 142 replace("status=4", "status={}".format(self.data[4])).\
138 143 replace("type=1", "type={}".format(self.data[5])).\
139 144 replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
140   - replace("companyId=9", "companyId={}".format(self.data[8])).\
  145 + replace("companyId=9", "").\
141 146 replace("attr=number", "attr=phone")
142 147 re=heb.get(url=url,headers=en.header)
143 148 print(re.json())
... ... @@ -147,5 +152,5 @@ class test_entranceFeeBill_details(unittest.TestCase):
147 152  
148 153 if __name__ == "__main__":
149 154  
150   - # unittest.main(verbosity=2)
151   - com.run_one(test_entranceFeeBill_details("test_entranceFeeBill_details_01"))
  155 + unittest.main(verbosity=2)
  156 + # com.run_one(test_entranceFeeBill_details("test_entranceFeeBill_details_01"))
... ...
testcase/heb/entranceFeeBill_proves/test_entranceFeeBill_provesPage.py
... ... @@ -15,8 +15,11 @@ class test_entranceFeeBill_provesPage(unittest.TestCase):
15 15  
16 16 @classmethod
17 17 def setUpClass(cls):
18   - cls.data=db.mysql_selectOne(en.sql)
19   - print(cls.data)
  18 + sql=en.sql_select(heb.user["heb_user01"]["firmId"])
  19 + #哈尔滨该页面没有用子公司字段
  20 + sql=sql.replace("AND a.company_id IS NOT NULL","")
  21 + #查询功能模块是否存在响应数据
  22 + cls.data=db.mysql_selectOne(sql)
20 23  
21 24  
22 25 @unittest.case_mark(my.mark())
... ... @@ -24,9 +27,9 @@ class test_entranceFeeBill_provesPage(unittest.TestCase):
24 27 "证明类型明细-查询:查询条件为“收费单号”,其余查询条件输入合法值,查询一条指定数据"
25 28 body= ((en.body.replace("202108110900139", self.data[1]).
26 29 replace("14436", str(self.data[9])).
27   - replace("雪莲果", self.data[11]).replace("14158", str(self.data[10])).
28   - replace("103", str(self.data[0]))).replace("1621",str(self.data[8]))).replace(
29   - "companyId=9","companyId={}".format(str(self.data[6])))
  30 + replace("雪莲果", self.data[11]).replace("14158", str(self.data[10])). \
  31 + replace("103", str(self.data[0]))).replace("1621",str(self.data[8]))). \
  32 + replace("companyId=9", "")
30 33 re=heb.post(url=en.url,headers=en.header,data=body.encode("utf-8"))
31 34 print(re.json())
32 35 self.assertEqual(re.status_code, 200)
... ... @@ -43,7 +46,7 @@ class test_entranceFeeBill_provesPage(unittest.TestCase):
43 46 replace("14158", str(self.data[10])).
44 47 replace("103", str(self.data[0]))).
45 48 replace("1621",str(self.data[8]))).\
46   - replace("companyId=9","companyId={}".format(str(self.data[6])))
  49 + replace("companyId=9","")
47 50 re=heb.post(url=en.url,headers=en.header,data=body.encode("utf-8"))
48 51 print(re.json())
49 52 self.assertEqual(re.status_code, 200)
... ... @@ -53,13 +56,13 @@ class test_entranceFeeBill_provesPage(unittest.TestCase):
53 56 def test_entranceFeeBill_provesPage_03(self):
54 57 "证明类型明细-查询:查询条件为“客户姓名”,其余查询条件输入合法值,查询一条指定数据"
55 58 body= ((en.body.replace("number", "cname").
56   - replace("202108110900139",self.data[3]).
57   - replace("14436", str(self.data[9])).
58   - replace("雪莲果", self.data[11]).
59   - replace("14158", str(self.data[10])).
60   - replace("103", str(self.data[0]))).
  59 + replace("202108110900139",self.data[3]).\
  60 + replace("14436", str(self.data[9])).\
  61 + replace("雪莲果", self.data[11]).\
  62 + replace("14158", str(self.data[10])).\
  63 + replace("103", str(self.data[0]))).\
61 64 replace("1621",str(self.data[8]))).\
62   - replace("companyId=9","companyId={}".format(str(self.data[6])))
  65 + replace("companyId=9","")
63 66 re=heb.post(url=en.url,headers=en.header,data=body.encode("utf-8"))
64 67 print(re.json())
65 68 self.assertEqual(re.status_code, 200)
... ... @@ -75,7 +78,7 @@ class test_entranceFeeBill_provesPage(unittest.TestCase):
75 78 replace("14158", str(self.data[10])).
76 79 replace("103", str(self.data[0]))).
77 80 replace("1621",str(self.data[8]))).\
78   - replace("companyId=9","companyId={}".format(str(self.data[6])))
  81 + replace("companyId=9","")
79 82 re=heb.post(url=en.url,headers=en.header,data=body.encode("utf-8"))
80 83 print(re.json())
81 84 self.assertEqual(re.status_code, 200)
... ... @@ -85,13 +88,13 @@ class test_entranceFeeBill_provesPage(unittest.TestCase):
85 88 def test_entranceFeeBill_provesPage_05(self):
86 89 "证明类型明细-查询:查询条件为“手机号”,其余查询条件输入合法值,查询一条指定数据"
87 90 body = ((en.body.replace("number", "phone").
88   - replace("202108110900139", self.data[4]).
89   - replace("14436", str(self.data[9])).
90   - replace("雪莲果", self.data[11]).
91   - replace("14158", str(self.data[10])).
92   - replace("103", str(self.data[0]))).
93   - replace("1621", str(self.data[8]))). \
94   - replace("companyId=9", "companyId={}".format(str(self.data[6])))
  91 + replace("202108110900139", self.data[4]).\
  92 + replace("14436", str(self.data[9])).\
  93 + replace("雪莲果", self.data[11]).\
  94 + replace("14158", str(self.data[10])).\
  95 + replace("103", str(self.data[0]))).\
  96 + replace("1621", str(self.data[8]))). \
  97 + replace("companyId=9", "")
95 98 re = heb.post(url=en.url, headers=en.header, data=body.encode("utf-8"))
96 99 print(re.json())
97 100 self.assertEqual(re.status_code, 200)
... ...