Commit 415b042c6bac0339b9ceb69c6902babf7063df24
1 parent
3b48859e
1
Showing
2 changed files
with
25 additions
and
29 deletions
testcase/hg/createTradingOrder/test_createTradingOrder.py
1 | -import unittest | |
2 | -import urllib3 | |
3 | -urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
4 | -from commons.MySession import hg,my | |
5 | -from commons import ConfigDB as db | |
6 | -from commons.api.hg.transaction.createAndTrade import createAndTrade | |
7 | -from commons.basic.registerRecord_save import registerRecord_save | |
8 | -creat = createAndTrade() | |
9 | -r = registerRecord_save() | |
1 | +import sys | |
2 | +# sys.path.extend(['E:\\PycharmWorkspace\\test-scripts']) | |
3 | +sys.path.extend(['/usr/jenkins/workspace/辅助脚本-创建交易单simple']) | |
4 | +import commons as com | |
5 | +from commons.MySession import hg | |
6 | +from commons.basic.createAndTrade import createAndTrade | |
7 | +from tmp import data | |
8 | +create = createAndTrade() | |
10 | 9 | |
10 | +print(data) | |
11 | 11 | |
12 | -""" | |
13 | -创建交易单 | |
14 | -""" | |
12 | +cmd_list=sys.argv[1:] | |
13 | +print(cmd_list) | |
15 | 14 | |
16 | -class test_createTradingOrder(unittest.TestCase): | |
17 | - "创建交易单" | |
18 | - @classmethod | |
19 | - def setUpClass(cls): | |
20 | - pass | |
15 | +if len(cmd_list)!=0: | |
16 | + for i in range(len(cmd_list)): | |
17 | + print("参数值",i,cmd_list[i]) | |
18 | + # print("测试市场{}".format(cmd_list[0])) | |
19 | + # print("请求body{}".format(cmd_list[1])) | |
20 | + # print("请求次数{}".format(cmd_list[2])) | |
21 | 21 | |
22 | 22 | |
23 | - def test_createTradingOrder_01(self): | |
24 | - "大客户创建订单" | |
25 | - # body = creat.body.copy() | |
26 | - # body["orderItemList"][0]["batchCode"] = self.batch | |
27 | - # print("创建订单body",body) | |
28 | - # re1 = hg.post(url = creat.url, headers = creat.header, json = body) | |
29 | - # print(re1.json()) | |
30 | - # self.assertEqual(re1.status_code, 200) | |
31 | - # self.assertTrue("'操作成功'" in str(re1.json()).replace(" ", "")) | |
32 | - print(1111) | |
23 | +if data!="None": | |
24 | + for i in range(int(cmd_list[1])): | |
25 | + body = data | |
26 | + print("创建订单body",body) | |
27 | + re = hg.post(url = create.url, headers = create.header, json = body) | |
28 | + print(re.json()) | |
29 | + | |
33 | 30 | |
34 | -if __name__ == '__main__': | |
35 | - unittest.main() | ... | ... |
tmp.py