Commit 7e2e06cdec9b458cb81caf71cbd7df92f350ed3f
1 parent
0c818a49
1
Showing
4 changed files
with
217 additions
and
0 deletions
testcase/hg/tradingOrder/test_Key_customer_login.py
0 → 100644
1 | +import unittest | ||
2 | +import urllib3 | ||
3 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
4 | +from commons.MySession import hg,my | ||
5 | +from commons.api.hg.transaction.Key_customer_login import Key_customer_login | ||
6 | +kcl = Key_customer_login() | ||
7 | + | ||
8 | +""" | ||
9 | +大客户登录 | ||
10 | +""" | ||
11 | + | ||
12 | +class test_Key_customer_login(unittest.TestCase): | ||
13 | + "大客户登录" | ||
14 | + @classmethod | ||
15 | + def setUpClass(cls): | ||
16 | + pass | ||
17 | + | ||
18 | + @unittest.case_mark(my.mark()) | ||
19 | + def test_Key_customer_login_01(self): | ||
20 | + "大客户登录" | ||
21 | + body = kcl.body.copy() | ||
22 | + re = hg.post(url = kcl.url, headers = kcl.header, json = body) | ||
23 | + print(re.json()) | ||
24 | + self.assertEqual(re.status_code, 200) | ||
25 | + self.assertTrue("'登录成功'" in str(re.json()).replace(" ", "")) | ||
26 | + self.assertEqual(re.json()["data"]["user"]["state"], 1,"为1时是大客户") | ||
27 | + @classmethod | ||
28 | + def tearDownClass(cls): | ||
29 | + pass | ||
30 | + | ||
31 | + | ||
32 | +if __name__ == '__main__': | ||
33 | + unittest.main() |
testcase/hg/tradingOrder/test_createAndTrade.py
0 → 100644
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() | ||
10 | + | ||
11 | +""" | ||
12 | +创建大客户订单 | ||
13 | +""" | ||
14 | + | ||
15 | +class test_createAndTrade(unittest.TestCase): | ||
16 | + "创建大客户订单" | ||
17 | + @classmethod | ||
18 | + def setUpClass(cls): | ||
19 | + # 新增一个进门批号单 | ||
20 | + # 新增一个进门批号单 | ||
21 | + # cls.aaa = db.mysql_selectOne(''' | ||
22 | + # SELECT | ||
23 | + # aua.account_id,auc.card_no,aua.customer_id,aua.customer_code,aua.customer_name,aua.customer_certificate_number | ||
24 | + # FROM | ||
25 | + # ( `dili_account`.`account_user_account` AS aua LEFT JOIN `dili_account`.`account_user_card` AS auc ON aua.account_id = auc.account_id ) | ||
26 | + # LEFT JOIN `dili-customer`.`special_permissions` AS sp ON aua.customer_id = sp.customer_id | ||
27 | + # ORDER BY aua.account_id DESC LIMIT 1 | ||
28 | + # ''') | ||
29 | + cls.aaa = db.mysql_selectOne(''' | ||
30 | + SELECT | ||
31 | + aua.account_id AS "账号id", | ||
32 | + auc.card_no AS "园区卡号", | ||
33 | + aua.customer_id AS "客户id", | ||
34 | + aua.customer_code AS "客户code", | ||
35 | + aua.customer_name AS "客户姓名", | ||
36 | + aua.customer_certificate_number AS "客户身份证号码", | ||
37 | + aua.hold_contacts_phone AS "持卡人电话" | ||
38 | +FROM | ||
39 | + ( `dili_account`.`account_user_account` AS aua LEFT JOIN `dili_account`.`account_user_card` AS auc ON aua.account_id = auc.account_id ) | ||
40 | + LEFT JOIN `dili-customer`.`special_permissions` AS sp ON aua.customer_id = sp.customer_id | ||
41 | +WHERE | ||
42 | + sp.customer_id = 141962 AND sp.market_id =15 | ||
43 | +ORDER BY | ||
44 | + aua.account_id DESC | ||
45 | + LIMIT 1 | ||
46 | + ''') | ||
47 | + body2 = r.body.copy() | ||
48 | + body2["accountId"] = str(cls.aaa[0]) | ||
49 | + body2["cardNo"] = str(cls.aaa[1]) | ||
50 | + body2["customerId"] = str(cls.aaa[2]) | ||
51 | + body2["customerCode"] = str(cls.aaa[3]) | ||
52 | + body2["customerName"] = str(cls.aaa[4]) | ||
53 | + body2["identityCardNo"] = str(cls.aaa[5]) | ||
54 | + body2["mobilephoneNumber"] = str(cls.aaa[6]) | ||
55 | + body2["categoryId"] = 44 | ||
56 | + body2["categoryCode"] = 754107 | ||
57 | + body2["categoryName"] = "葡萄" | ||
58 | + re = hg.post(url = r.url, headers = r.header, json = body2) | ||
59 | + "获取批号" | ||
60 | + print("获取批号结果:",re.json()) | ||
61 | + cls.batch = re.json()["data"]["batchCode"] | ||
62 | + return cls.batch | ||
63 | + | ||
64 | + @unittest.case_mark(my.mark()) | ||
65 | + def test_createAndTrade_01(self): | ||
66 | + "大客户创建订单" | ||
67 | + body = creat.body.copy() | ||
68 | + body["orderItemList"][0]["batchCode"] = self.batch | ||
69 | + print("创建订单body",body) | ||
70 | + re1 = hg.post(url = creat.url, headers = creat.header, json = body) | ||
71 | + print(re1.json()) | ||
72 | + self.assertEqual(re1.status_code, 200) | ||
73 | + self.assertTrue("'操作成功'" in str(re1.json()).replace(" ", "")) | ||
74 | + @classmethod | ||
75 | + def tearDownClass(cls): | ||
76 | + pass | ||
77 | + | ||
78 | + | ||
79 | +if __name__ == '__main__': | ||
80 | + unittest.main() |
testcase/hg/tradingOrder/test_l_createAndTrade.py
0 → 100644
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.l_createAndTrade import l_createAndTrade | ||
7 | +from commons.basic.registerRecord_save import registerRecord_save | ||
8 | +lcat = l_createAndTrade() | ||
9 | +r = registerRecord_save() | ||
10 | + | ||
11 | +""" | ||
12 | +创建普通客户订单 | ||
13 | +""" | ||
14 | + | ||
15 | +class test_l_createAndTrade(unittest.TestCase): | ||
16 | + "创建普通客户订单" | ||
17 | + @classmethod | ||
18 | + def setUpClass(cls): | ||
19 | + # 新增一个进门批号单 | ||
20 | + cls.aaa = db.mysql_selectOne(''' | ||
21 | + SELECT | ||
22 | + aua.account_id AS "账号id", | ||
23 | + auc.card_no AS "园区卡号", | ||
24 | + aua.customer_id AS "客户id", | ||
25 | + aua.customer_code AS "客户code", | ||
26 | + aua.customer_name AS "客户姓名", | ||
27 | + aua.customer_certificate_number AS "客户身份证号码", | ||
28 | + aua.hold_contacts_phone AS "持卡人电话" | ||
29 | +FROM | ||
30 | + ( `dili_account`.`account_user_account` AS aua LEFT JOIN `dili_account`.`account_user_card` AS auc ON aua.account_id = auc.account_id ) | ||
31 | + LEFT JOIN `dili-customer`.`special_permissions` AS sp ON aua.customer_id = sp.customer_id | ||
32 | +WHERE | ||
33 | + sp.customer_id = 141962 AND sp.market_id =15 | ||
34 | +ORDER BY | ||
35 | + aua.account_id DESC | ||
36 | + LIMIT 1 | ||
37 | + ''') | ||
38 | + body2 = r.body1.copy() | ||
39 | + body2["accountId"] = str(cls.aaa[0]) | ||
40 | + body2["cardNo"] = str(cls.aaa[1]) | ||
41 | + body2["customerId"] = str(cls.aaa[2]) | ||
42 | + body2["customerCode"] = str(cls.aaa[3]) | ||
43 | + body2["customerName"] = str(cls.aaa[4]) | ||
44 | + body2["identityCardNo"] = str(cls.aaa[5]) | ||
45 | + body2["mobilephoneNumber"] = str(cls.aaa[6]) | ||
46 | + body2["categoryId"] = 44 | ||
47 | + body2["categoryCode"] = 754107 | ||
48 | + body2["categoryName"] = "葡萄" | ||
49 | + re = hg.post(url = r.url, headers = r.header, json = body2) | ||
50 | + "获取批号" | ||
51 | + print("获取批号结果:",re.json()) | ||
52 | + cls.batch = re.json()["data"]["batchCode"] | ||
53 | + return cls.batch | ||
54 | + | ||
55 | + @unittest.case_mark(my.mark()) | ||
56 | + def test_l_createAndTrade_01(self): | ||
57 | + "普通客户创建订单" | ||
58 | + body = lcat.body.copy() | ||
59 | + body["orderItemList"][0]["batchCode"] = self.batch | ||
60 | + print("创建订单body",body) | ||
61 | + re1 = hg.post(url = lcat.url, headers = lcat.header, json = body) | ||
62 | + print(re1.json()) | ||
63 | + self.assertEqual(re1.status_code, 200) | ||
64 | + self.assertTrue("'操作成功'" in str(re1.json()).replace(" ", "")) | ||
65 | + @classmethod | ||
66 | + def tearDownClass(cls): | ||
67 | + pass | ||
68 | + | ||
69 | + | ||
70 | +if __name__ == '__main__': | ||
71 | + unittest.main() |
testcase/hg/tradingOrder/test_ordinary_customer_login.py
0 → 100644
1 | +import unittest | ||
2 | +import urllib3 | ||
3 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
4 | +from commons.MySession import hg,my | ||
5 | +from commons.api.hg.transaction.ordinary_customer_login import ordinary_customer_login | ||
6 | +ocl = ordinary_customer_login() | ||
7 | + | ||
8 | +""" | ||
9 | +普通客户登录 | ||
10 | +""" | ||
11 | + | ||
12 | +class test_Key_customer_login(unittest.TestCase): | ||
13 | + "普通客户登录" | ||
14 | + @classmethod | ||
15 | + def setUpClass(cls): | ||
16 | + pass | ||
17 | + | ||
18 | + @unittest.case_mark(my.mark()) | ||
19 | + def test_Key_customer_login_01(self): | ||
20 | + "普通客户登录" | ||
21 | + body = ocl.body.copy() | ||
22 | + re = hg.post(url = ocl.url, headers = ocl.header, json = body) | ||
23 | + print(re.json()) | ||
24 | + self.assertEqual(re.status_code, 200) | ||
25 | + self.assertTrue("'登录成功'" in str(re.json()).replace(" ", "")) | ||
26 | + self.assertNotEqual(re.json()["data"]["user"]["state"], 1,"为1时是大客户") | ||
27 | + @classmethod | ||
28 | + def tearDownClass(cls): | ||
29 | + pass | ||
30 | + | ||
31 | + | ||
32 | +if __name__ == '__main__': | ||
33 | + unittest.main() |