Commit 3bf4e02deb7eff32da4a3ac36f53a8bde638356c

Authored by lixi
1 parent 906f9edf

更新哈尔滨用例脚本

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