Commit f9878f3e4f6ffbe15066e2ca4c23d7f41df05a1a
1 parent
041d0c6c
useHeadersRequestsDemo-test_doAddA
Showing
3 changed files
with
44 additions
and
2 deletions
config/marketConfig/test_config_hg
report/test.log
1 | +[2021-07-20 14:27:04] [INFO] : ====================================================================================== | |
2 | +[2021-07-20 14:27:04] [INFO] : http://test.trace.diligrp.com:8393/fieldConfig/doUpdate.action | |
3 | +None | |
4 | +{'moduleType': '1', 'marketId': '8', 'fieldConfigDetailList': [{'fieldName': 'unitPrice', 'jsonPath': '$.unitPrice', 'defaultId': '3', 'displayed': '1', 'required': '0'}, {'fieldName': 'arrivalTallynos', 'jsonPath': '$.arrivalTallynos', 'defaultId': '10', 'displayed': '1', 'required': '0'}, {'fieldName': 'brandName', 'jsonPath': '$.brandName', 'defaultId': '5', 'displayed': '1', 'required': '0'}, {'fieldName': 'truckTareWeight', 'jsonPath': '$.truckTareWeight', 'defaultId': '1', 'displayed': '1', 'required': '0'}, {'fieldName': 'originId', 'jsonPath': '$.originId', 'defaultId': '7', 'displayed': '1', 'required': '0'}, {'fieldName': 'specName', 'jsonPath': '$.specName', 'defaultId': '4', 'displayed': '1', 'required': '0'}, {'fieldName': 'truckType', 'jsonPath': '$.truckType', 'defaultId': '2', 'displayed': '1', 'required': '1', 'availableValueList': ['10', '20']}, {'fieldName': 'imageCertList', 'jsonPath': '$.imageCertList[*]certType', 'defaultId': '11', 'displayed': '1', 'required': '0', 'availableValueList': ['2', '3']}, {'fieldName': 'arrivalDatetime', 'jsonPath': '$.arrivalDatetime', 'defaultId': '9', 'displayed': '1', 'required': '0'}, {'fieldName': 'remark', 'jsonPath': '$.remark', 'defaultId': '8', 'displayed': '1', 'required': '0'}, {'fieldName': 'remark', 'jsonPath': '$.remark', 'defaultId': '6', 'displayed': '1', 'required': '0'}, {'fieldName': 'measureType', 'jsonPath': '$.measureType', 'defaultId': '12', 'displayed': '1', 'required': '1', 'availableValueList': ['10', '20']}]} | |
5 | +{'headers': {'Host': 'test.trace.diligrp.com:8393', 'Connection': 'keep-alive', 'Content-Length': '1378', 'Accept': 'application/json,text/javascript,*/*;q=0.01', 'X-Requested-With': 'XMLHttpRequest', 'User-Agent': 'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/91.0.4472.77Safari/537.36', 'Content-Type': 'application/json', 'Origin': 'http://test.trace.diligrp.com:8393', 'Referer': 'http://test.trace.diligrp.com:8393/fieldConfig/bill.html', 'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7'}} | |
6 | +[2021-07-20 14:27:04] [INFO] : ====================================================================================== | |
7 | +[2021-07-20 14:27:04] [INFO] : http://test.trace.diligrp.com:8393/newRegisterBill/doAdd.action | |
8 | +{"registerHeadWeight": "0", "registerHeadRemainWeight": "0", "imageCertList": [], "measureType": 20, "registType": 10, "userId": 516, "arrivalTallynos": [], "arrivalDatetime": "", "truckType": 10, "weight": "111", "weightUnit": 1, "productName": "\u5927\u767d\u83dc", "productId": 2190, "originName": "", "originId": "", "unitPrice": "", "truckTareWeight": "", "remark": "", "specName": "", "brandName": "", "plate": "\u5dddA123456"} | |
9 | +{} | |
10 | + | ... | ... |
testcase/doAdd/test_doAddA.py
0 → 100644
1 | +#!/usr/bin/python | |
2 | +# -*- coding: UTF-8 -*- | |
3 | +import unittest | |
4 | +import urllib3 | |
5 | +from commons import common as com | |
6 | +from commons.MySession import my | |
7 | +from commons.api.fieldConfig import fieldConfig | |
8 | +from commons.api.doAdd import doAdd | |
9 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
10 | +do=doAdd() | |
11 | +field=fieldConfig() | |
12 | + | |
13 | +import json | |
14 | + | |
15 | + | |
16 | +class test_doAdd(unittest.TestCase): | |
17 | + "新增登记接口" | |
18 | + | |
19 | + @classmethod | |
20 | + def setUpClass(cls): | |
21 | + #通过字段配置接口提前配置新增页的字段配置 | |
22 | + my.post(url=field.url,headers=field.header,json=field.body) | |
23 | + | |
24 | + # @unittest.case_mark(my.mark("test")) | |
25 | + def test_doAdd_01(self): | |
26 | + "成功新增一个商品为大白菜的报备单,重量为111" | |
27 | + #请求数据不需要修改,直接POST请求 | |
28 | + re = my.useHeadersRequests(method="POST",url=do.url,headers=do.header,data=json.dumps(do.body)) | |
29 | + print(re.json()) | |
30 | + #响应断言 | |
31 | + self.assertEqual(re.status_code, 200) | |
32 | + self.assertTrue("'code':'200'" in str(re.json()).replace(" ","")) | |
0 | 33 | \ No newline at end of file | ... | ... |