Commit e21cb3379d0c73290f829dbd666c2d7ab35c5a9f
1 parent
617a87d9
创建大客户订单
Showing
4 changed files
with
126 additions
and
0 deletions
commons/api/hg/transaction/Key_customer_login.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | +""" | |
3 | +@Time : 2021/9/9 14:24 | |
4 | +@Auth : wlm | |
5 | +@File :Key_customer_login.py | |
6 | +@IDE :PyCharm | |
7 | +""" | |
8 | +""" | |
9 | +大客户模式——登录 | |
10 | +""" | |
11 | +from commons import common as com | |
12 | +from commons.MySession import hg | |
13 | +class Key_customer_login(): | |
14 | + | |
15 | + def __init__(self): | |
16 | + self.url = "http://test.uap.diligrp.com/api/authenticationApi/loginWeb" | |
17 | + self.header = { | |
18 | + "Content-Type":"text/plain; charset=utf-8", | |
19 | + } | |
20 | + self.body = { | |
21 | + "userName":"111222", | |
22 | + "password":"ZfeMAEQsKtLwnj16HwUjFy3NObIVQ8cnjrPuSAFk+hXEOV3hXxTqZFTFM0j4xPhPHK8Cq8RFA10xxP6P2U7SgqZPivlCZl1AnpblIiqA07GIN+4fseHvJd9fUR2fcZOWdRXed/EoiJ6MkRnAUVvsRAcDI8GRsXesv7n9yanYBxE=" | |
23 | + } | |
24 | + | |
25 | + | |
26 | +kcl = Key_customer_login() | |
27 | +print(kcl.body) | |
28 | +re = hg.post(url = kcl.url,json = kcl.body,headers = kcl.header,proxies=hg.myproxies) | |
29 | +print(re.json()) | |
30 | +print(re.headers) | |
0 | 31 | \ No newline at end of file | ... | ... |
commons/api/hg/transaction/ordinary_customer_login.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | +""" | |
3 | +@Time : 2021/9/9 14:56 | |
4 | +@Auth : wlm | |
5 | +@File :ordinary_customer_login.py | |
6 | +@IDE :PyCharm | |
7 | +""" | |
8 | +""" | |
9 | +普通客户模式——登录 | |
10 | +""" | |
11 | +from commons import common as com | |
12 | +from commons.MySession import hg | |
13 | +class ordinary_customer_login(): | |
14 | + | |
15 | + def __init__(self): | |
16 | + self.url = "http://test.uap.diligrp.com/api/authenticationApi/loginWeb" | |
17 | + self.header = { | |
18 | + "Content-Type":"text/plain; charset=utf-8", | |
19 | + } | |
20 | + self.body = { | |
21 | + "userName":"333444", | |
22 | + "password":"GuqHBFJ3t+S6+Iu05bDMbrxy5ZH3POY+egSoYhENV528Nk32B/2NOUhdDvaNwsaYBMf+LxCzJMnF2n3xQ4C94PaH4yqimM9BoNEhMXVXhm4GNRn2GYEihO8U2lvBwC45T7mcbEK1wvy9ie+kFi/PwkQb0nDRzjkR38s6yDU8fF8=" | |
23 | + } | |
24 | + | |
25 | + | |
26 | +ocl = ordinary_customer_login() | |
27 | +print(ocl.body) | |
28 | +re = hg.post(url = ocl.url,json = ocl.body,headers = ocl.header) | |
29 | +print(re.json()) | |
30 | +print(re.headers) | |
0 | 31 | \ No newline at end of file | ... | ... |
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_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() | ... | ... |