Commit 35351b9ef47fd9dbb3904eeacf30811a462517a4
1 parent
035004b8
更新readme
Showing
17 changed files
with
49 additions
and
4 deletions
.settings/org.eclipse.core.resources.prefs
0 → 100644
README.md
commons/__pycache__/ConfigDB.cpython-36.pyc
No preview for this file type
commons/__pycache__/Faker.cpython-36.pyc
No preview for this file type
commons/__pycache__/Logging.cpython-36.pyc
No preview for this file type
commons/__pycache__/MySession.cpython-36.pyc
No preview for this file type
commons/__pycache__/SendEmail.cpython-36.pyc
No preview for this file type
commons/__pycache__/__init__.cpython-36.pyc
No preview for this file type
commons/__pycache__/clientSession.cpython-36.pyc
0 → 100644
No preview for this file type
commons/__pycache__/common.cpython-36.pyc
No preview for this file type
commons/__pycache__/readConf.cpython-36.pyc
0 → 100644
No preview for this file type
commons/api/__pycache__/__init__.cpython-36.pyc
No preview for this file type
commons/api/__pycache__/upStream.cpython-36.pyc
No preview for this file type
commons/common.py
@@ -51,6 +51,28 @@ def get_api_config(api,section,key): | @@ -51,6 +51,28 @@ def get_api_config(api,section,key): | ||
51 | log.error("File Not Exist :<%r> "%str(api_config_path)) | 51 | log.error("File Not Exist :<%r> "%str(api_config_path)) |
52 | raise Exception("File Not Exist :<%r> "%str(api_config_path)) | 52 | raise Exception("File Not Exist :<%r> "%str(api_config_path)) |
53 | 53 | ||
54 | +def get_market_config(api,section,key): | ||
55 | + "object file is *src/config/marketConfig/*.conf" | ||
56 | + current_path=os.path.dirname(__file__) | ||
57 | + src_path=os.path.dirname(current_path) | ||
58 | + api_path=src_path+"/config/marketConfig/" | ||
59 | + api_config_path=api_path+api+".conf" | ||
60 | + #验证文件是否存在 | ||
61 | + file_path = os.path.exists(api_config_path) | ||
62 | + if file_path: | ||
63 | + #获取文件的数据 | ||
64 | + if isinstance(key,int): | ||
65 | + log.error("key of section cannot be int Type :<%r> "%str(key)) | ||
66 | + raise Exception("key of section cannot be int Type :<%r> "%str(key)) | ||
67 | + else: | ||
68 | + config = configparser.ConfigParser() | ||
69 | + config.read(api_config_path,encoding="utf-8") | ||
70 | + return config.get(section, key) | ||
71 | + else: | ||
72 | + log.error("File Not Exist :<%r> "%str(api_config_path)) | ||
73 | + raise Exception("File Not Exist :<%r> "%str(api_config_path)) | ||
74 | + | ||
75 | + | ||
54 | 76 | ||
55 | def run_one(name): | 77 | def run_one(name): |
56 | test_suite = unittest.TestSuite() | 78 | test_suite = unittest.TestSuite() |
@@ -89,3 +111,5 @@ def run_Name(name): | @@ -89,3 +111,5 @@ def run_Name(name): | ||
89 | print("运行用例为{}".format(test_cases)) | 111 | print("运行用例为{}".format(test_cases)) |
90 | runner = unittest.TextTestRunner() | 112 | runner = unittest.TextTestRunner() |
91 | runner.run(test_cases) | 113 | runner.run(test_cases) |
114 | + | ||
115 | +# print(get_market_config("test_config_hg2","loginInfo","userName")) | ||
92 | \ No newline at end of file | 116 | \ No newline at end of file |
commons/readConf.py
@@ -23,9 +23,9 @@ class readConfig(object): | @@ -23,9 +23,9 @@ class readConfig(object): | ||
23 | if self.evn_name == 'nt': | 23 | if self.evn_name == 'nt': |
24 | self.relative_path = r'/config/marketConfig/' | 24 | self.relative_path = r'/config/marketConfig/' |
25 | # # 本地调试路径 | 25 | # # 本地调试路径 |
26 | - # self.file_path = os.path.abspath(os.path.join(os.getcwd(), "../..")) + self.relative_path+self.file_name | 26 | + self.file_path = os.path.abspath(os.path.join(os.getcwd(), "../..")) + self.relative_path+self.file_name |
27 | # 本地main方法执行路径 | 27 | # 本地main方法执行路径 |
28 | - self.file_path = os.path.abspath(os.path.join(os.getcwd(), "../")) + self.relative_path + self.file_name | 28 | +# self.file_path = os.path.abspath(os.path.join(os.getcwd(), "../")) + self.relative_path + self.file_name |
29 | elif self.evn_name == 'posix': | 29 | elif self.evn_name == 'posix': |
30 | self.relative_path = r'/config/marketConfig/' | 30 | self.relative_path = r'/config/marketConfig/' |
31 | self.file_path = os.path.abspath(os.path.join(os.getcwd())) + self.relative_path + self.file_name | 31 | self.file_path = os.path.abspath(os.path.join(os.getcwd())) + self.relative_path + self.file_name |
config/marketConfig/test_config_hg2.conf
0 → 100644
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 | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
testcase/upStream/test_upStream.py
@@ -6,7 +6,6 @@ from commons.MySession import my | @@ -6,7 +6,6 @@ from commons.MySession import my | ||
6 | from commons.api.upStream import upStream | 6 | from commons.api.upStream import upStream |
7 | from commons import common as com | 7 | from commons import common as com |
8 | from commons import common | 8 | from commons import common |
9 | -from commons import Faker | ||
10 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | 9 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
11 | uu=upStream() | 10 | uu=upStream() |
12 | 11 |