Commit 73eaf4bff3c201396b2f14cfd20694c2dd9723a0
1 parent
a0e72c42
更新进门称重的方法
Showing
3 changed files
with
127 additions
and
3 deletions
commons/basic/some_basic.py
0 → 100644
1 | +#!/usr/bin/python | |
2 | +# -*- coding: UTF-8 -*- | |
3 | + | |
4 | +import os | |
5 | +import sys,time | |
6 | +import json | |
7 | +from commons import common as com | |
8 | +from commons.MySession import sy1 | |
9 | + | |
10 | +class get_basic_data(object): | |
11 | + url_listCarType = "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCarType" | |
12 | + url_cusCategory= "http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree" | |
13 | + url_userApi= "http://test.gateway.diligrp.com:8285/dili-uap/userApi/listByExample.api" | |
14 | + url_prove_type= "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid?pid=prove_type" | |
15 | + url_tradeType= "http://test.gateway.diligrp.com:8285/assets-service/api/tradeType/query" | |
16 | + url_goods_tag= "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid?pid=goods_tag" | |
17 | + url_dep= "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/dep?keyword=" | |
18 | + url_address= "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/address" | |
19 | + | |
20 | + header = { | |
21 | + "UAP_accessToken": "demo", | |
22 | + "UAP_refreshToken": "demo", | |
23 | + "UAP_firmId": "9", | |
24 | + "Content-Type": "application/json", | |
25 | + "Content-Length": "23"} | |
26 | + | |
27 | + body_listCarType = {"businessCode":"jmsf"} | |
28 | + body_cusCategory = {"marketId":9,"state":1} | |
29 | + body_userApi = {"firmCode":"sy","departmentId":58,"keyword":""} | |
30 | + body_tradeType = {"pageNum":100,"pageSize":100,"marketId":9} | |
31 | + body_address = {"province":"四川省","city":"成都市","area":None} | |
32 | + | |
33 | + def __init__(self,market): | |
34 | + self.market=market | |
35 | + self.url_listCarType = get_basic_data.url_listCarType.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
36 | + self.url_cusCategory = get_basic_data.url_cusCategory.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
37 | + self.url_userApi = get_basic_data.url_userApi.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
38 | + self.url_prove_type = get_basic_data.url_prove_type.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
39 | + self.url_tradeType = get_basic_data.url_tradeType.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
40 | + self.url_goods_tag = get_basic_data.url_goods_tag.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
41 | + self.url_dep = get_basic_data.url_dep.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
42 | + self.url_address = get_basic_data.url_address.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
43 | + self.header = get_basic_data.header | |
44 | + self.header["UAP_accessToken"] = self.market.cookies["UAP_accessToken"] | |
45 | + self.header["UAP_refreshToken"] = self.market.cookies["UAP_refreshToken"] | |
46 | + self.header["UAP_firmId"] = self.market.cookies["UAP_firmId"] | |
47 | + | |
48 | + def car_list(self): | |
49 | + "车型" | |
50 | + h=self.header.copy() | |
51 | + re = self.market.post(url=self.url_listCarType, headers=h,json=self.body_listCarType) | |
52 | + # print(re.json()) | |
53 | + return re.json() | |
54 | + | |
55 | + def cusCategory(self): | |
56 | + "商品" | |
57 | + h=self.header.copy() | |
58 | + re = self.market.post(url=self.url_cusCategory, headers=h,json=self.body_cusCategory) | |
59 | + # print(re.json()) | |
60 | + return re.json() | |
61 | + | |
62 | + def userApi(self): | |
63 | + "用户" | |
64 | + h=self.header.copy() | |
65 | + re = self.market.post(url=self.url_userApi, headers=h,json=self.body_userApi) | |
66 | + # print(re.json()) | |
67 | + return re.json() | |
68 | + | |
69 | + def prove_type(self): | |
70 | + "证明类型" | |
71 | + h=self.header.copy() | |
72 | + h.pop("Content-Type") | |
73 | + h.pop("Content-Length") | |
74 | + re = self.market.get(url=self.url_prove_type, headers=h) | |
75 | + # print(re.json()) | |
76 | + return re.json() | |
77 | + | |
78 | + def tradeType(self): | |
79 | + "交易类型" | |
80 | + h=self.header.copy() | |
81 | + re = self.market.post(url=self.url_tradeType, headers=h,json=self.body_tradeType) | |
82 | + # print(re.json()) | |
83 | + return re.json() | |
84 | + | |
85 | + def goods_tag(self): | |
86 | + "货物标签" | |
87 | + h=self.header.copy() | |
88 | + h.pop("Content-Type") | |
89 | + h.pop("Content-Length") | |
90 | + re = self.market.get(url=self.url_goods_tag, headers=h) | |
91 | + # print(re.json()) | |
92 | + return re.json() | |
93 | + | |
94 | + def dep(self): | |
95 | + "部门" | |
96 | + h=self.header.copy() | |
97 | + h.pop("Content-Type") | |
98 | + h.pop("Content-Length") | |
99 | + re = self.market.get(url=self.url_dep, headers=h) | |
100 | + # print(re.json()) | |
101 | + return re.json() | |
102 | + | |
103 | + def address(self): | |
104 | + "产地" | |
105 | + h=self.header.copy() | |
106 | + re = self.market.post(url=self.url_address, headers=h,json=self.body_address) | |
107 | + # print(re.json()) | |
108 | + return re.json() | |
109 | + | |
110 | +# a=get_basic_data(sy1) | |
111 | +# a.write_file(a.car_list()) | |
112 | +# a.write_file("sy","car_list",a.car_list()) | |
113 | +# a.read_file() | |
114 | +# a.car_list() | |
115 | +# a.cusCategory() | |
116 | +# a.userApi() | |
117 | +# a.prove_type() | |
118 | +# a.tradeType() | |
119 | +# a.goods_tag() | |
120 | +# a.dep() | |
121 | +# a.address() | |
0 | 122 | \ No newline at end of file | ... | ... |
config/global_data.conf
main.py
... | ... | @@ -12,11 +12,14 @@ from commons import common as com |
12 | 12 | from commons.MySession import my |
13 | 13 | from commons.scripts import delReport |
14 | 14 | |
15 | -def Create_Testcase_suite(): | |
15 | +def Create_Testcase_suite(path=""): | |
16 | 16 | '''创建测试套件''' |
17 | + if path!="": | |
18 | + path+="/" | |
19 | + print(path) | |
17 | 20 | testunit=unittest.TestSuite() |
18 | 21 | test_Loader = DiscoveringTestLoader() |
19 | - discover=test_Loader.discover("./testcase/",pattern='test_*.py',top_level_dir=None) | |
22 | + discover=test_Loader.discover("./testcase/{}".format(path),pattern='test_*.py',top_level_dir=None) | |
20 | 23 | print(discover) |
21 | 24 | for test_suite in discover: |
22 | 25 | testunit.addTests(test_suite) | ... | ... |