Commit 98fa764ecaf4477ab33e4c010be741553ed631e9
1 parent
24a2dc77
跟新
Showing
9 changed files
with
593 additions
and
0 deletions
commons/api/addJmsfDemo.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | + | |
3 | +# @Time : 2021/7/27 16:36 | |
4 | +# @Author : Ljq | |
5 | +# @File : jmsf.py | |
6 | +# @Software: PyCharm | |
7 | + | |
8 | +""" | |
9 | +三种接口定义方式 | |
10 | +""" | |
11 | + | |
12 | +import json | |
13 | +from commons.scripts import dealContentType as dct | |
14 | +from commons import common | |
15 | +from commons.MySession import my | |
16 | + | |
17 | +# 使用def的方式直接定义 | |
18 | +def get_carType(host="",**kwargs): | |
19 | + url = host + "/jmsf-web/api/jmsf/query/listCarType" | |
20 | + data = {"businessCode":"jmsf"} | |
21 | + headers = dct.jsonCode() | |
22 | + data=dict(data,**kwargs) | |
23 | + res = my.useHeadersRequests(method="POST",url=url,data=json.dumps(data),headers=headers) | |
24 | + return res | |
25 | + | |
26 | + | |
27 | + | |
28 | +# 使用类的方式将参数聚合 | |
29 | +class get_carTypeClass(object): | |
30 | + def __init__(self,host): | |
31 | + self.method = "post" | |
32 | + self.url = host + "/jmsf-web/api/jmsf/query/listCarType" | |
33 | + self.data = {"businessCode": "jmsf"} | |
34 | + self.headers = dct.jsonCode() | |
35 | + | |
36 | +# 使用类的方式将参数聚合 | |
37 | +class get_carTypeClassB(object): | |
38 | + url = "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCarType" | |
39 | + method = "post" | |
40 | + data = {"businessCode": "jmsf"} | |
41 | + headers = dct.jsonCode() | |
42 | + | |
43 | + def __init__(self): | |
44 | + self.url = get_carTypeClassB.url.replace("http://test.", common.get_global_config("global_data", "environment", "en")) | |
45 | + # self.header = get_carTypeClassB.headers | |
46 | + # self.method = get_carTypeClassB.method | |
47 | + # self.data = get_carTypeClassB.data | |
0 | 48 | \ No newline at end of file | ... | ... |
commons/api/zcApi.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | + | |
3 | +# @Time : 2021/7/28 11:14 | |
4 | +# @Author : Ljq | |
5 | +# @File : zcApi.py | |
6 | +# @Software: PyCharm | |
7 | + | |
8 | +""" | |
9 | +整车进门相关接口 | |
10 | +""" | |
11 | + | |
12 | +import json | |
13 | +from commons.scripts import dealContentType as dct | |
14 | +from commons import common | |
15 | +from commons.MySession import my | |
16 | + | |
17 | + | |
18 | +def get_carType(host="",**kwargs): | |
19 | + """车型获取""" | |
20 | + url = host + "/jmsf-web/api/jmsf/query/listCarType" | |
21 | + data = {"businessCode":"jmsf"} | |
22 | + headers = dct.jsonCode() | |
23 | + data = dict(data, **kwargs) | |
24 | + res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers) | |
25 | + return res | |
26 | + | |
27 | +def get_listCategoryByCondition(host="",**kwargs): | |
28 | + """商品获取""" | |
29 | + url = host + "/assets-service/api/cusCategory/getTree" | |
30 | + # marketId = my.userInfo()[] | |
31 | + data = {"marketId":9,"state":1,"keyword":"蔬菜"} | |
32 | + headers = dct.jsonCode() | |
33 | + data = dict(data, **kwargs) | |
34 | + res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers) | |
35 | + return res | |
36 | + | |
37 | +def get_listByExample(host="",**kwargs): | |
38 | + """获取接车员信息""" | |
39 | + url = host + "/dili-uap/userApi/listByExample.api" | |
40 | + data = {"firmCode":"sy","departmentId":58,"keyword":""} | |
41 | + headers = dct.jsonCode() | |
42 | + data = dict(data, **kwargs) | |
43 | + res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers) | |
44 | + return res | |
45 | + | |
46 | +def get_proveType(host="",**kwargs): | |
47 | + """查询证明类型""" | |
48 | + url = host + "/jmsf-web/api/jmsf/query/listCodeByPid" | |
49 | + data = {"pid":"prove_type"} | |
50 | + headers = dct.jsonCode() | |
51 | + data = dict(data, **kwargs) | |
52 | + res = my.useHeadersRequests(method="get", url=url, params=json.loads(json.dumps(data)), headers=headers) | |
53 | + return res | |
54 | + | |
55 | +def query_transactionType(host="",**kwargs): | |
56 | + """查交易类型""" | |
57 | + url = host + "/assets-service/api/tradeType/query" | |
58 | + data = {"pageNum":100,"pageSize":100,"marketId":9} | |
59 | + headers = dct.jsonCode() | |
60 | + data = dict(data, **kwargs) | |
61 | + res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers) | |
62 | + return res | |
63 | + | |
64 | +def get_goodsTag(host="",**kwargs): | |
65 | + """获取货物标签""" | |
66 | + url = host + "/jmsf-web/api/jmsf/query/listCodeByPid" | |
67 | + data = {"pid":"goods_tag"} | |
68 | + headers = dct.jsonCode() | |
69 | + data = dict(data, **kwargs) | |
70 | + res = my.useHeadersRequests(method="get", url=url, params=json.loads(json.dumps(data)), headers=headers) | |
71 | + return res | |
72 | + | |
73 | +def get_address(host="",**kwargs): | |
74 | + """产地获取""" | |
75 | + url = host + "/jmsf-web/api/jmsf/query/address" | |
76 | + data = {"province":"C","city":None,"area":None} | |
77 | + headers = dct.jsonCode() | |
78 | + data = dict(data, **kwargs) | |
79 | + res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers) | |
80 | + return res | |
81 | + | |
82 | +def get_dep(host="",**kwargs): | |
83 | + """获取部门信息""" | |
84 | + url = host + "/jmsf-web/api/jmsf/query/dep" | |
85 | + data = {"keyword":""} | |
86 | + headers = dct.jsonCode() | |
87 | + data = dict(data, **kwargs) | |
88 | + res = my.useHeadersRequests(method="get", url=url, data=json.dumps(data), headers=headers) | |
89 | + return res | |
90 | + | |
91 | + | |
92 | + | |
93 | +def get_duplicateToken(host=""): | |
94 | + """进门防重接口""" | |
95 | + url = host + "/jmsf-web/appCommon/duplicateToken.action" | |
96 | + headers = dct.jsonCode() | |
97 | + res = my.useHeadersRequests(method="get", url=url, headers=headers) | |
98 | + return res | |
99 | + | |
100 | + | |
101 | +def create_wholeCarWeighSave(host="",duplicateToken=None,**kwargs): | |
102 | + """查询证明类型 | |
103 | + :param host: | |
104 | + :param **kwargs: | |
105 | + { | |
106 | + "carTypeCode": "${carTypeCode}", | |
107 | + "carTypeId": ${carTypeId}, | |
108 | + "carTypeName": "${carTypeName}", | |
109 | + "carTypeWeight": ${carTypeWeight}, | |
110 | + "plate": "${plate}", | |
111 | + "inGreeterId": 0, | |
112 | + "inGreeterName": null, | |
113 | + "productId": ${productId}, | |
114 | + "productName": "${productName}", | |
115 | + "proveTypeCode": ${proveTypeCode}, | |
116 | + "proveTypeName": "${proveTypeName}", | |
117 | + "weighRemark": "", | |
118 | + "weighmanRecord": { | |
119 | + "grossWeight": ${grossWeight}, | |
120 | + "grossWeightDate": "${grossWeightDate}", | |
121 | + "newWeight":${grossWeight}, | |
122 | + "tareWeight": ${tareWeight}, | |
123 | + "tareWeightDate": null, | |
124 | + "weighImgs": [] | |
125 | + }, | |
126 | + "productCode": null, | |
127 | + "trailerNumber": "${plate}", | |
128 | + "pathAddress": "A4-BB-6D-0A-F4-13", | |
129 | + "haveTruckWeight": false, | |
130 | + "source": 4, | |
131 | + "entryPlateInputType": 1, | |
132 | + "dep": ${feeDepId}, | |
133 | + "depName": "${feeDepName}", | |
134 | + "cateId": ${cateId}, | |
135 | + "notice": 0, | |
136 | + "backSkinTwo": -1, | |
137 | + "recordOriginId": 0, | |
138 | + "recordOriginName": null, | |
139 | + "recordProductId": 0, | |
140 | + "recordProductName": null, | |
141 | + "recordWeight": null, | |
142 | + "codeIc": null, | |
143 | + "codeId": 0, | |
144 | + "difference": 0, | |
145 | + "bindRecordSign": 0, | |
146 | + "recordDesc": null, | |
147 | + "hasCodeItems": false, | |
148 | + "customerId": 0, | |
149 | + "customerName": "", | |
150 | + "driverIc": "", | |
151 | + "driverName": "", | |
152 | + "totalPrice": null, | |
153 | + "originId": ${originId}, | |
154 | + "origin": "${origin}", | |
155 | + "originCode": "${originCode}", | |
156 | + "tradeType": "${tradeType}", | |
157 | + "tradeTypeName": "${tradeTypeName}", | |
158 | + "weight": ${grossWeight}, | |
159 | + "pwd": "", | |
160 | + "type": 1, | |
161 | + "ic": "", | |
162 | + "boothNumber": "210622124244", | |
163 | + "productState": ${productState}, | |
164 | + "accountId": 0, | |
165 | + "passCheckId": 0, | |
166 | + "passCheckName": null, | |
167 | + "tradeTypeId": ${tradeTypeId}, | |
168 | + "id": 0, | |
169 | + "protocolId": null, | |
170 | + "goodsTagId": ${goodsTagId} | |
171 | + } | |
172 | + :return:""" | |
173 | + url = host + "/jmsf-web/api/entrace/wholeCarWeighSave" | |
174 | + data = {"carTypeCode": "003", "carTypeId": 53, "carTypeName": "板车", "carTypeWeight": 333, "plate": "213123", | |
175 | + "inGreeterId": 223, "inGreeterName": "测试沈阳", "productId": 14152, "productName": "蔬菜", "proveTypeCode": 665, | |
176 | + "proveTypeName": "食品安全", "weighRemark": "备注", | |
177 | + "weighmanRecord": {"grossWeight": 3.0, "grossWeightDate": "2021-07-28 16:28:24", "newWeight": 2.0, | |
178 | + "tareWeight": 1.0, "tareWeightDate": None, "weighImgs": []}, "productCode": None, | |
179 | + "trailerNumber": "", "pathAddress": "A4-BB-6D-0A-F4-13", "haveTruckWeight": False, "source": 4, | |
180 | + "entryPlateInputType": 1, "dep": 58, "depName": "水果部", "cateId": 14152, "notice": 0, "backSkinTwo": -1, | |
181 | + "recordOriginId": 0, "recordOriginName": None, "recordProductId": 0, "recordProductName": None, | |
182 | + "recordWeight": None, "codeIc": None, "codeId": 0, "difference": 0, "bindRecordSign": 0, "recordDesc": None, | |
183 | + "hasCodeItems": False, "customerId": 0, "customerName": "", "driverIc": None, "driverName": None, | |
184 | + "totalPrice": None, "originId": 500101, "origin": "万州区", "originCode": "023", "tradeType": "9001", | |
185 | + "tradeTypeName": "沈阳1号", "weight": 2.0, "pwd": "", "type": 1, "ic": "", "boothNumber": "210728154359", | |
186 | + "productState": 1, "accountId": 0, "passCheckId": 0, "passCheckName": None, "tradeTypeId": 70, "id": 0, | |
187 | + "protocolId": None, "goodsTagId": 663} | |
188 | + headers = dct.jsonCode() | |
189 | + headers["jmsf_duplicate_commit_token"] = duplicateToken | |
190 | + data = dict(data, **kwargs) | |
191 | + res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers) | |
192 | + return res | |
193 | + | |
194 | +def create_jmsf(host=None,keyword="蔬菜",**kwargs): | |
195 | + """ | |
196 | + | |
197 | + """ | |
198 | + # 获取车型 | |
199 | + carType = get_carType(host=host) | |
200 | + print(carType.text) | |
201 | + print(carType.json()["data"][0]) | |
202 | + carTypeCode = carType.json()["data"][0]["code"] | |
203 | + carTypeId = carType.json()["data"][0]["id"] | |
204 | + carTypeName = carType.json()["data"][0]["carTypeName"] | |
205 | + carTypeWeight = carType.json()["data"][0]["weight"] | |
206 | + | |
207 | + # 获取商品 | |
208 | + categoryByCondition = get_listCategoryByCondition(host=host,keyword=keyword) | |
209 | + print(categoryByCondition.json()) | |
210 | + cateId = categoryByCondition.json()["data"][0]["id"] | |
211 | + productId = categoryByCondition.json()["data"][0]["id"] | |
212 | + productName = categoryByCondition.json()["data"][0]["name"] | |
213 | + productCode = categoryByCondition.json()["data"][0]["keycode"] | |
214 | + | |
215 | + # 获取接车员信息 | |
216 | + listByExample = get_listByExample(host=host) | |
217 | + print(listByExample.json()) | |
218 | + inGreeterId = listByExample.json()["data"][0]["id"] | |
219 | + inGreeterName = listByExample.json()["data"][0]["realName"] | |
220 | + | |
221 | + # 获取交易类型 | |
222 | + transactionType = query_transactionType(host=host) | |
223 | + print(transactionType.json()) | |
224 | + tradeType = transactionType.json()["rows"][0]["code"] | |
225 | + tradeTypeId = transactionType.json()["rows"][0]["id"] | |
226 | + tradeTypeName = transactionType.json()["rows"][0]["name"] | |
227 | + | |
228 | + # 获取货物标签 | |
229 | + goodsTag = get_goodsTag(host=host) | |
230 | + print(goodsTag.json()) | |
231 | + goodsTagId = goodsTag.json()["data"][0]["id"] | |
232 | + | |
233 | + # 产地信息获取 | |
234 | + address = get_address(host=host) | |
235 | + print(address.json()) | |
236 | + originId = address.json()["data"][0]["id"] | |
237 | + origin = address.json()["data"][0]["name"] | |
238 | + originCode = address.json()["data"][0]["cityCode"] | |
239 | + | |
240 | + # 查询部门信息 | |
241 | + depRes = get_dep(host=host) | |
242 | + print(depRes.json()) | |
243 | + feeDepId = depRes.json()["data"][0]["id"] | |
244 | + feeDepName = depRes.json()["data"][0]["name"] | |
245 | + | |
246 | + # 获取证明类型 | |
247 | + proveType = get_proveType(host=host) | |
248 | + print(proveType.json()) | |
249 | + proveTypeCode = proveType.json()["data"][0]["id"] | |
250 | + proveTypeName = proveType.json()["data"][0]["name"] | |
251 | + | |
252 | + # 获取防重token | |
253 | + duplicateTokenRes = get_duplicateToken(host=host) | |
254 | + print(duplicateTokenRes.json()) | |
255 | + duplicateToken = duplicateTokenRes.json()["data"] | |
256 | + | |
257 | + # 创建生成进门单 | |
258 | + plate = "川A12323" | |
259 | + productState = "1" | |
260 | + trailerNumber = plate | |
261 | + cre_res = create_wholeCarWeighSave(host=host, duplicateToken=duplicateToken, | |
262 | + carTypeCode=carTypeCode, carTypeId=carTypeId, | |
263 | + carTypeName=carTypeName, carTypeWeight=carTypeWeight, plate=plate, | |
264 | + productId=productId, productName=productName, proveTypeCode=proveTypeCode, | |
265 | + proveTypeName=proveTypeName, trailerNumber=trailerNumber, depName=feeDepName, | |
266 | + cateId=cateId, originId=originId, origin=origin, originCode=originCode, | |
267 | + tradeType=tradeType, tradeTypeName=tradeTypeName, productState=productState, | |
268 | + tradeTypeId=tradeTypeId, goodsTagId=goodsTagId, inGreeterId=inGreeterId, | |
269 | + inGreeterName=inGreeterName, dep=feeDepId) | |
270 | + print(cre_res.json()) | |
0 | 271 | \ No newline at end of file | ... | ... |
testcase/test_ZC/__init__.py
0 → 100644
testcase/test_ZC/demo.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | + | |
3 | +# @Time : 2021/7/28 16:59 | |
4 | +# @Author : Ljq | |
5 | +# @File : demo.py | |
6 | +# @Software: PyCharm | |
7 | + | |
8 | +""" | |
9 | + | |
10 | +""" | |
11 | + | |
12 | +import json | |
13 | + | |
14 | +a = {"aa":"阿三大苏打","bb":"bb","cc":{"cc1":"啊实打"}} | |
15 | +print(a) | |
16 | +data = {"cc":{"cc1":"2"}} | |
17 | +b = json.dumps(a,ensure_ascii=False) | |
18 | +print(b) | |
0 | 19 | \ No newline at end of file | ... | ... |
testcase/test_ZC/test_ZC.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | + | |
3 | +# @Time : 2021/7/28 11:15 | |
4 | +# @Author : Ljq | |
5 | +# @File : test_ZC.py | |
6 | +# @Software: PyCharm | |
7 | + | |
8 | +""" | |
9 | +整车进门测试用例 | |
10 | +""" | |
11 | + | |
12 | +import json | |
13 | +import unittest | |
14 | +from commons.scripts.readConf import rC | |
15 | +from commons.api import zcApi as zcA | |
16 | + | |
17 | +class test_demo(unittest.TestCase): | |
18 | + """整车-整车进门单创建""" | |
19 | + def setUp(self) -> None: | |
20 | + pass | |
21 | + | |
22 | + def tearDown(self) -> None: | |
23 | + pass | |
24 | + | |
25 | + | |
26 | + @classmethod | |
27 | + def setUpClass(cls) -> None: | |
28 | + cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost") | |
29 | + | |
30 | + @classmethod | |
31 | + def tearDownClass(cls) -> None: | |
32 | + pass | |
33 | + | |
34 | + def test_get_carType(self): | |
35 | + """整车-整车创建:获取车型接口调用测试""" | |
36 | + # 获取车型 | |
37 | + carType = zcA.get_carType(host=self.gatewayHost) | |
38 | + print(carType.text) | |
39 | + print(carType.json()["data"][0]) | |
40 | + carTypeCode = carType.json()["data"][0]["code"] | |
41 | + carTypeId = carType.json()["data"][0]["id"] | |
42 | + carTypeName = carType.json()["data"][0]["carTypeName"] | |
43 | + carTypeWeight = carType.json()["data"][0]["weight"] | |
44 | + | |
45 | + # 获取商品 | |
46 | + categoryByCondition = zcA.get_listCategoryByCondition(host=self.gatewayHost) | |
47 | + print(categoryByCondition.json()) | |
48 | + cateId = categoryByCondition.json()["data"][0]["id"] | |
49 | + productId = categoryByCondition.json()["data"][0]["id"] | |
50 | + productName = categoryByCondition.json()["data"][0]["name"] | |
51 | + productCode = categoryByCondition.json()["data"][0]["keycode"] | |
52 | + | |
53 | + # 获取商品 | |
54 | + listByExample = zcA.get_listByExample(host=self.gatewayHost) | |
55 | + print(listByExample.json()) | |
56 | + inGreeterId = listByExample.json()["data"][0]["id"] | |
57 | + inGreeterName = listByExample.json()["data"][0]["realName"] | |
58 | + | |
59 | + # 获取交易类型 | |
60 | + transactionType = zcA.query_transactionType(host=self.gatewayHost) | |
61 | + print(transactionType.json()) | |
62 | + tradeType = transactionType.json()["rows"][0]["code"] | |
63 | + tradeTypeId = transactionType.json()["rows"][0]["id"] | |
64 | + tradeTypeName = transactionType.json()["rows"][0]["name"] | |
65 | + | |
66 | + # 获取货物标签 | |
67 | + goodsTag = zcA.get_goodsTag(host=self.gatewayHost) | |
68 | + print(goodsTag.json()) | |
69 | + goodsTagId = goodsTag.json()["data"][0]["id"] | |
70 | + | |
71 | + # 产地信息获取 | |
72 | + address = zcA.get_address(host=self.gatewayHost) | |
73 | + print(address.json()) | |
74 | + originId = address.json()["data"][0]["id"] | |
75 | + origin = address.json()["data"][0]["name"] | |
76 | + originCode = address.json()["data"][0]["cityCode"] | |
77 | + | |
78 | + # 查询部门信息 | |
79 | + depRes = zcA.get_dep(host=self.gatewayHost) | |
80 | + print(depRes.json()) | |
81 | + feeDepId = depRes.json()["data"][0]["id"] | |
82 | + feeDepName = depRes.json()["data"][0]["name"] | |
83 | + | |
84 | + # 获取证明类型 | |
85 | + proveType = zcA.get_proveType(host=self.gatewayHost) | |
86 | + print(proveType.json()) | |
87 | + proveTypeCode = proveType.json()["data"][0]["id"] | |
88 | + proveTypeName = proveType.json()["data"][0]["name"] | |
89 | + | |
90 | + # 获取防重token | |
91 | + duplicateTokenRes = zcA.get_duplicateToken(host=self.gatewayHost) | |
92 | + print(duplicateTokenRes.json()) | |
93 | + duplicateToken = duplicateTokenRes.json()["data"] | |
94 | + | |
95 | + # 创建生成进门单 | |
96 | + plate = "川A12323" | |
97 | + productState = "1" | |
98 | + trailerNumber = plate | |
99 | + cre_res = zcA.create_wholeCarWeighSave(host=self.gatewayHost,duplicateToken=duplicateToken,carTypeCode=carTypeCode,carTypeId=carTypeId, | |
100 | + carTypeName=carTypeName,carTypeWeight=carTypeWeight,plate=plate, | |
101 | + productId=productId,productName=productName,proveTypeCode=proveTypeCode, | |
102 | + proveTypeName=proveTypeName,trailerNumber=trailerNumber,depName=feeDepName, | |
103 | + cateId=cateId,originId=originId,origin=origin,originCode=originCode, | |
104 | + tradeType=tradeType,tradeTypeName=tradeTypeName,productState=productState, | |
105 | + tradeTypeId=tradeTypeId,goodsTagId=goodsTagId,inGreeterId=inGreeterId, | |
106 | + inGreeterName=inGreeterName,dep=feeDepId) | |
107 | + print(cre_res.json()) | |
108 | + | |
109 | + def test_cre(self): | |
110 | + """调用方法1""" | |
111 | + zcA.create_jmsf(host=self.gatewayHost,keyword="山药") | |
112 | + | |
113 | + | |
114 | + | |
115 | + | |
116 | + | |
117 | +# if __name__ == "__main__": | |
118 | +# unittest.main() | |
119 | +# 啊实打 | |
0 | 120 | \ No newline at end of file | ... | ... |
testcase/test_demo/__init__.py
0 → 100644
testcase/test_demo/test_demo_class.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | + | |
3 | +# @Time : 2021/7/27 17:33 | |
4 | +# @Author : Ljq | |
5 | +# @File : test_demo_class.py | |
6 | +# @Software: PyCharm | |
7 | + | |
8 | +""" | |
9 | +测试get_carTypeClass | |
10 | +""" | |
11 | + | |
12 | +import json | |
13 | +import unittest | |
14 | +from commons.scripts.readConf import rC | |
15 | +from commons.MySession import my | |
16 | +from commons.api import addJmsfDemo as aJ | |
17 | +gCTC = aJ.get_carTypeClass(host=rC.returnOptionsItems("host","gatewayHost")) | |
18 | + | |
19 | + | |
20 | +class test_demo(unittest.TestCase): | |
21 | + def setUp(self) -> None: | |
22 | + pass | |
23 | + | |
24 | + def tearDown(self) -> None: | |
25 | + pass | |
26 | + | |
27 | + @classmethod | |
28 | + def setUpClass(cls) -> None: | |
29 | + pass | |
30 | + | |
31 | + @classmethod | |
32 | + def tearDownClass(cls) -> None: | |
33 | + pass | |
34 | + | |
35 | + def test_check_class(self): | |
36 | + res = my.useHeadersRequests(method=gCTC.method,url=gCTC.url,headers=gCTC.headers,data=json.dumps(gCTC.data)) | |
37 | + print(res.text) | |
38 | + | |
39 | +if __name__ == "__main__": | |
40 | + unittest.main() | |
0 | 41 | \ No newline at end of file | ... | ... |
testcase/test_demo/test_demo_classB.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | + | |
3 | +# @Time : 2021/7/27 17:44 | |
4 | +# @Author : Ljq | |
5 | +# @File : test_demo_classB.py | |
6 | +# @Software: PyCharm | |
7 | + | |
8 | +""" | |
9 | +测试get_carTypeClassB类 | |
10 | +""" | |
11 | + | |
12 | +import json | |
13 | +import unittest | |
14 | +from commons.scripts.readConf import rC | |
15 | +from commons.MySession import my | |
16 | +from commons.api import addJmsfDemo as aJ | |
17 | +gCTC = aJ.get_carTypeClassB() | |
18 | + | |
19 | + | |
20 | +class test_demo(unittest.TestCase): | |
21 | + def setUp(self) -> None: | |
22 | + pass | |
23 | + | |
24 | + def tearDown(self) -> None: | |
25 | + pass | |
26 | + | |
27 | + @classmethod | |
28 | + def setUpClass(cls) -> None: | |
29 | + pass | |
30 | + | |
31 | + @classmethod | |
32 | + def tearDownClass(cls) -> None: | |
33 | + pass | |
34 | + | |
35 | + def test_check_class(self): | |
36 | + res = my.useHeadersRequests(method=gCTC.method,url=gCTC.url,headers=gCTC.headers,data=json.dumps(gCTC.data)) | |
37 | + print(res.text) | |
38 | + | |
39 | +if __name__ == "__main__": | |
40 | + unittest.main() | |
0 | 41 | \ No newline at end of file | ... | ... |
testcase/test_demo/test_demo_def.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | + | |
3 | +# @Time : 2021/7/27 16:43 | |
4 | +# @Author : Ljq | |
5 | +# @File : test_demo.py | |
6 | +# @Software: PyCharm | |
7 | + | |
8 | +""" | |
9 | +测试get_carType方法 | |
10 | +""" | |
11 | + | |
12 | +import json | |
13 | +import unittest | |
14 | +from commons.scripts.readConf import rC | |
15 | +from commons.api import addJmsfDemo as aJ | |
16 | + | |
17 | +class test_demo(unittest.TestCase): | |
18 | + def setUp(self) -> None: | |
19 | + pass | |
20 | + | |
21 | + def tearDown(self) -> None: | |
22 | + pass | |
23 | + | |
24 | + | |
25 | + @classmethod | |
26 | + def setUpClass(cls) -> None: | |
27 | + cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost") | |
28 | + print("self.gatewayHost", cls.gatewayHost) | |
29 | + | |
30 | + @classmethod | |
31 | + def tearDownClass(cls) -> None: | |
32 | + pass | |
33 | + | |
34 | + def test_check_def(self): | |
35 | + res = aJ.get_carType(host=self.gatewayHost) | |
36 | + print(res.text) | |
37 | + | |
38 | +if __name__ == "__main__": | |
39 | + unittest.main() | |
0 | 40 | \ No newline at end of file | ... | ... |