Commit ce9ae390bcba8e8da16527ab7590509fb3418d11
Merge remote-tracking branch 'origin/master'
Showing
11 changed files
with
72 additions
and
54 deletions
commons/Faker.py
... | ... | @@ -18,7 +18,7 @@ class random_data(): |
18 | 18 | return self.fake.name() |
19 | 19 | |
20 | 20 | def identity_card(self): |
21 | - "随机姓名" | |
21 | + "随机证件" | |
22 | 22 | return self.fake.ssn(min_age=18, max_age=90) |
23 | 23 | |
24 | 24 | def plate(self): |
... | ... | @@ -26,6 +26,7 @@ class random_data(): |
26 | 26 | return self.fake.license_plate() |
27 | 27 | |
28 | 28 | def plate_cn(self,plate_len=6): |
29 | + "随机车牌号" | |
29 | 30 | char0='京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽赣粤青藏川宁琼' |
30 | 31 | char1='ABCDEFGHJKLMNPQRSTUVWXYZ'#车牌号中没有I和O,可自行百度 |
31 | 32 | char2='1234567890' | ... | ... |
commons/api/entranceFeeBillList.py
... | ... | @@ -93,7 +93,7 @@ def get_city(host="",name=None): |
93 | 93 | # print(a.json()) |
94 | 94 | # orderId = a.json()["rows"][0]["id"] |
95 | 95 | # print(orderId) |
96 | -# res = getOrderDetails(host="http://test.jmsf.diligrp.com:8385",orderId=orderId) | |
96 | +# res = get_OrderDetails(host="http://test.jmsf.diligrp.com:8385",orderId=orderId) | |
97 | 97 | # print(res.text) |
98 | 98 | # res = get_icCheck(host="http://test.jmsf.diligrp.com:8385",ic=888810032426) |
99 | 99 | # print(res.text) | ... | ... |
commons/api/weighingServiceSave.py
... | ... | @@ -2,8 +2,8 @@ |
2 | 2 | # -*- coding: UTF-8 -*- |
3 | 3 | import urllib3 |
4 | 4 | from commons import common as com |
5 | -from commons.MySession import my,sy1,sy2 | |
6 | -from commons.api.duplicateToken import duplicateToken | |
5 | +from commons.MySession import sy1 | |
6 | +from commons.basic.duplicateToken import duplicateToken | |
7 | 7 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
8 | 8 | du=duplicateToken() |
9 | 9 | ... | ... |
commons/api/zcApi.py
... | ... | @@ -7,6 +7,8 @@ |
7 | 7 | |
8 | 8 | """ |
9 | 9 | 整车进门相关接口 |
10 | +1.整车进门基础接口封装 | |
11 | +2.整车进门create_jmsf进门单一步创建接口封装 | |
10 | 12 | """ |
11 | 13 | |
12 | 14 | import json,time,random |
... | ... | @@ -190,18 +192,23 @@ def create_wholeCarWeighSave(host="",duplicateToken=None,**kwargs): |
190 | 192 | res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers) |
191 | 193 | return res |
192 | 194 | |
193 | -def create_jmsf(host=None,keyword="蔬菜",newWeight=99,plate="川A12345"): | |
195 | +def create_jmsf(host=None,carTypeName=None,keyword="蔬菜",userName=None,transactionName=None, | |
196 | + newWeight=99,plate="川A12345",goodsTagName=None,depName=None,proveName=None): | |
194 | 197 | """ |
195 | 198 | |
196 | 199 | """ |
197 | 200 | # 获取车型 |
198 | 201 | carType = get_carType(host=host) |
199 | 202 | print(carType.text) |
200 | - print(carType.json()["data"][0]) | |
201 | - carTypeCode = carType.json()["data"][0]["code"] | |
202 | - carTypeId = carType.json()["data"][0]["id"] | |
203 | - carTypeName = carType.json()["data"][0]["carTypeName"] | |
204 | - carTypeWeight = carType.json()["data"][0]["weight"] | |
203 | + if carTypeName ==None: | |
204 | + carTypeIndex = 0 | |
205 | + else: | |
206 | + carTypeIndex = carType.json()["data"].index( | |
207 | + [i for i in carType.json()["data"] if i["carTypeName"] == carTypeName][0]) | |
208 | + carTypeCode = carType.json()["data"][carTypeIndex]["code"] | |
209 | + carTypeId = carType.json()["data"][carTypeIndex]["id"] | |
210 | + carTypeName = carType.json()["data"][carTypeIndex]["carTypeName"] | |
211 | + carTypeWeight = carType.json()["data"][carTypeIndex]["weight"] | |
205 | 212 | |
206 | 213 | # 获取商品 |
207 | 214 | categoryByCondition = get_listCategoryByCondition(host=host,keyword=keyword) |
... | ... | @@ -211,23 +218,39 @@ def create_jmsf(host=None,keyword="蔬菜",newWeight=99,plate="川A12345"): |
211 | 218 | productName = categoryByCondition.json()["data"][0]["name"] |
212 | 219 | productCode = categoryByCondition.json()["data"][0]["keycode"] |
213 | 220 | |
214 | - # 获取商品 | |
221 | + # 获取接车员信息 | |
215 | 222 | listByExample = get_listByExample(host=host) |
216 | 223 | print(listByExample.json()) |
217 | - inGreeterId = listByExample.json()["data"][0]["id"] | |
218 | - inGreeterName = listByExample.json()["data"][0]["realName"] | |
224 | + if userName ==None: | |
225 | + listByExampleIndex = 0 | |
226 | + else: | |
227 | + listByExampleIndex = listByExample.json()["data"].index( | |
228 | + [i for i in listByExample.json()["data"] if i["userName"] == userName][0]) | |
229 | + inGreeterId = listByExample.json()["data"][listByExampleIndex]["id"] | |
230 | + inGreeterName = listByExample.json()["data"][listByExampleIndex]["realName"] | |
219 | 231 | |
220 | 232 | # 获取交易类型 |
221 | 233 | transactionType = query_transactionType(host=host) |
222 | 234 | print(transactionType.json()) |
223 | - tradeType = transactionType.json()["rows"][0]["code"] | |
224 | - tradeTypeId = transactionType.json()["rows"][0]["id"] | |
225 | - tradeTypeName = transactionType.json()["rows"][0]["name"] | |
235 | + print("交易类型") | |
236 | + if transactionName ==None: | |
237 | + transactionTypeIndex = 0 | |
238 | + else: | |
239 | + transactionTypeIndex = transactionType.json()["rows"].index( | |
240 | + [i for i in transactionType.json()["rows"] if i["name"] == transactionName][0]) | |
241 | + tradeType = transactionType.json()["rows"][transactionTypeIndex]["code"] | |
242 | + tradeTypeId = transactionType.json()["rows"][transactionTypeIndex]["id"] | |
243 | + tradeTypeName = transactionType.json()["rows"][transactionTypeIndex]["name"] | |
226 | 244 | |
227 | 245 | # 获取货物标签 |
228 | 246 | goodsTag = get_goodsTag(host=host) |
229 | 247 | print(goodsTag.json()) |
230 | - goodsTagId = goodsTag.json()["data"][0]["id"] | |
248 | + if goodsTagName ==None: | |
249 | + transactionTypeIndex = 0 | |
250 | + else: | |
251 | + transactionTypeIndex = goodsTag.json()["data"].index( | |
252 | + [i for i in goodsTag.json()["data"] if i["name"] == goodsTagName][0]) | |
253 | + goodsTagId = goodsTag.json()["data"][transactionTypeIndex]["id"] | |
231 | 254 | |
232 | 255 | # 产地信息获取 |
233 | 256 | address = get_address(host=host) |
... | ... | @@ -239,14 +262,24 @@ def create_jmsf(host=None,keyword="蔬菜",newWeight=99,plate="川A12345"): |
239 | 262 | # 查询部门信息 |
240 | 263 | depRes = get_dep(host=host) |
241 | 264 | print(depRes.json()) |
242 | - feeDepId = depRes.json()["data"][0]["id"] | |
243 | - feeDepName = depRes.json()["data"][0]["name"] | |
265 | + if depName ==None: | |
266 | + depResIndex = 0 | |
267 | + else: | |
268 | + depResIndex = depRes.json()["data"].index( | |
269 | + [i for i in depRes.json()["data"] if i["name"] == depName][0]) | |
270 | + feeDepId = depRes.json()["data"][depResIndex]["id"] | |
271 | + feeDepName = depRes.json()["data"][depResIndex]["name"] | |
244 | 272 | |
245 | 273 | # 获取证明类型 |
246 | 274 | proveType = get_proveType(host=host) |
247 | 275 | print(proveType.json()) |
248 | - proveTypeCode = proveType.json()["data"][0]["id"] | |
249 | - proveTypeName = proveType.json()["data"][0]["name"] | |
276 | + if depName ==None: | |
277 | + proveTypeIndex = 0 | |
278 | + else: | |
279 | + proveTypeIndex = proveType.json()["data"].index( | |
280 | + [i for i in proveType.json()["data"] if i["name"] == proveName][0]) | |
281 | + proveTypeCode = proveType.json()["data"][proveTypeIndex]["id"] | |
282 | + proveTypeName = proveType.json()["data"][proveTypeIndex]["name"] | |
250 | 283 | |
251 | 284 | # 获取防重token |
252 | 285 | duplicateTokenRes = get_duplicateToken(host=host) |
... | ... | @@ -278,5 +311,5 @@ def create_jmsf(host=None,keyword="蔬菜",newWeight=99,plate="川A12345"): |
278 | 311 | tradeType=tradeType, tradeTypeName=tradeTypeName, productState=productState, |
279 | 312 | tradeTypeId=tradeTypeId, goodsTagId=goodsTagId, inGreeterId=inGreeterId, |
280 | 313 | inGreeterName=inGreeterName, dep=feeDepId, weighmanRecord=weighmanRecord) |
281 | - print(cre_res.json()) | |
314 | + # print(cre_res.json()) | |
282 | 315 | return cre_res |
283 | 316 | \ No newline at end of file | ... | ... |
commons/api/duplicateToken.py renamed to commons/basic/duplicateToken.py
... | ... | @@ -7,6 +7,7 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
7 | 7 | |
8 | 8 | |
9 | 9 | class duplicateToken(): |
10 | + "称重防重接口,返回唯一的commit_token" | |
10 | 11 | url = "http://test.gateway.diligrp.com:8285/jmsf-web/appCommon/duplicateToken.action" |
11 | 12 | header = { |
12 | 13 | "UAP_accessToken": "demo", | ... | ... |
commons/basic/listCarType.py
config/marketConfig/test_config_hg2.conf deleted
100644 → 0
1 | -#沈阳市场信息 | |
2 | -[loginInfo] | |
3 | -userName=scgy | |
4 | -password=DYdgRcAyx2bPboAmu0tgIYBM1kMxFAuDty7IQk4162Zh+8KKa8jtu6xIjG9W4yauTfPiuP1sqxDatskXFqCOz76ea14AqRCYEBz53xVr+vLfcz9zOB2d1T3aIlJbEk8yi2c21pd/MFkBw+Fhd0tky/6eN8kJA8mtsj3uDwSb9qo= | |
5 | - | |
6 | -[testInfo] | |
7 | -#已添加的身份证号 | |
8 | -cCNum=11010119990307865X | |
9 | -cCNumB=110101199903077593 | |
10 | -#入库未开卡的卡号 | |
11 | -cardNum=210607113166 | |
12 | -#已开卡的卡号 | |
13 | -cardNumRe=888800001207 | |
14 | -#密码设置 | |
15 | -loginPwd=111111 | |
16 | - | |
17 | -[host] | |
18 | -cardHost=http://test.card.diligrp.com:8386 | |
19 | -uapHost=http://test.uap.diligrp.com | |
20 | -gatewayHost=http://test.gateway.diligrp.com:8285 | |
21 | 0 | \ No newline at end of file |
report/test.log
testcase/test_ZC/demo.py
... | ... | @@ -16,7 +16,7 @@ import urllib |
16 | 16 | # print(time.localtime()) |
17 | 17 | import urllib3 |
18 | 18 | |
19 | -print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) | |
19 | +# print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) | |
20 | 20 | |
21 | 21 | # a = {"aa":"阿三大苏打","bb":"bb","cc":{"cc1":"啊实打","cc2":"ad"}} |
22 | 22 | # print(a) |
... | ... | @@ -30,7 +30,10 @@ print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) |
30 | 30 | # b = dict(a,**kwargs) |
31 | 31 | # print(b) |
32 | 32 | |
33 | -a = {"收费单号":"number","车号":"likePlate","商品":"goods","收费员":"pay","客户姓名":"cname","客户卡号":"ic","手机号码":"phone"} | |
34 | -print(a["收费单号"]) | |
35 | -urllib3 | |
36 | - | |
33 | +a = {"code":"200","data":[{"autoPass":2,"autoSave":1,"carTypeName":"板车","code":"003","id":53,"number":"0007","remark":"","status":1,"tag":"jmsf","weight":333},{"autoPass":1,"autoSave":1,"carTypeName":"挂车","code":"gc","id":59,"number":"0030","remark":"","status":1,"tag":"jmsf","weight":1},{"autoPass":2,"carTypeName":"柜车","code":"23","id":60,"number":"0031","remark":"","status":1,"tag":"jmsf","weight":0},{"autoPass":1,"autoSave":1,"carTypeName":"地排车","code":"008","id":87,"number":"0001","remark":"","status":1,"tag":"jmsf","weight":2},{"autoPass":2,"autoSave":1,"carTypeName":"玉玺","code":"888","id":128,"number":"0042","remark":"","status":1,"tag":"jmsf","weight":0},{"autoPass":2,"carTypeName":"军车","code":"555","id":61,"number":"0013","remark":"","status":1,"tag":"jmsf","weight":0},{"autoPass":2,"carTypeName":"小面包","code":"","id":142,"number":"0008","remark":"","status":1,"tag":"jmsf","weight":22},{"autoPass":1,"autoSave":1,"carTypeName":"小轿车","code":"001","id":51,"number":"0002","remark":"","status":1,"tag":"jmsf","weight":0},{"autoPass":2,"carTypeName":"123456789012345","code":"1245","id":160,"number":"0044","remark":"","status":1,"tag":"jmsf","weight":11},{"autoPass":2,"carTypeName":"111111111222222","code":"6432","id":161,"number":"0045","remark":"","status":1,"tag":"jmsf","weight":22},{"autoPass":2,"autoSave":1,"carTypeName":"test0731","code":"12345","id":162,"number":"0047","remark":"asdf g hgsaf","status":1,"tag":"jmsf","weight":11}],"message":"OK","result":"OK","success":True} | |
34 | +print(a["data"]) | |
35 | +# lambda file_name: os.path.getmtime(report_path + file_name) | |
36 | +b = a["data"].index([i for i in a["data"] if i["carTypeName"]=="地排车"][0]) | |
37 | +print(b) | |
38 | +# c ="2" if b !=None else "1" | |
39 | +# print(c) | |
37 | 40 | \ No newline at end of file | ... | ... |
testcase/test_ZC/test_ZC.py
... | ... | @@ -122,7 +122,11 @@ class test_demo(unittest.TestCase): |
122 | 122 | |
123 | 123 | def test_cre(self): |
124 | 124 | """调用方法1""" |
125 | - cre_res = zcA.create_jmsf(host=self.gatewayHost,plate="川B00001",keyword="山药",newWeight=20) | |
125 | + cre_res = zcA.create_jmsf(host=self.gatewayHost,carTypeName="挂车",plate="川B00001",keyword="山药", | |
126 | + userName="ty_test",transactionName="沈阳2号",newWeight=20, | |
127 | + depName="接车部",goodsTagName="货物标签测试",proveName="绿色蔬菜") | |
128 | + print(cre_res.json()) | |
129 | + cre_res = zcA.create_jmsf(host=self.gatewayHost,plate="川B00002",newWeight=20) | |
126 | 130 | print(cre_res.json()) |
127 | 131 | |
128 | 132 | ... | ... |
testcase/weightBizBill/test_weighingServiceSave.py
... | ... | @@ -16,7 +16,7 @@ class test_weighingServiceSave(unittest.TestCase): |
16 | 16 | |
17 | 17 | @unittest.case_mark(my.mark()) |
18 | 18 | def test_weighingServiceSave_01(self): |
19 | - "称重服务-称重服务:成功新增一条称重服务单" | |
19 | + "称重服务:成功新增一条称重服务单" | |
20 | 20 | body=we.body.copy() |
21 | 21 | body["carTypeId"]=li.car_list()["data"][0]["id"] |
22 | 22 | body["carTypeName"]=li.car_list()["data"][0]["carTypeName"] | ... | ... |