Commit 617a87d9e372a0f5f8edef4dffaca6e6bb411ba3
Merge remote-tracking branch 'origin/master'
Showing
3 changed files
with
81 additions
and
26 deletions
commons/api/hg/loan_generalCustomer/generalCustomerLoan_enforce.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | +""" | |
3 | +@Time : 2021/8/31 14:43 | |
4 | +@Auth : wlm | |
5 | +@File :createAndTrade.py | |
6 | +@IDE :PyCharm | |
7 | +""" | |
8 | +""" | |
9 | +普通客户模式——执行借款 | |
10 | +""" | |
11 | +from commons import common as com | |
12 | +from commons.MySession import hg | |
13 | + | |
14 | +class generalCustomerLoan_enforce(): | |
15 | + | |
16 | + def __init__(self): | |
17 | + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/generalCustomerLoan/enforce/66?_t="+str(com.time_stamp()) | |
18 | + self.header = { | |
19 | + "Connection" :"keep-alive", | |
20 | + "Accept" :"application/json, text/plain, */*", | |
21 | + "UAP_accessToken" :".-.---", | |
22 | + "UAP_refreshToken" :".-.---", | |
23 | + "Accept-Language" :"zh-CN,zh;q=0.9", | |
24 | + "Accept-Encoding" :"gzip, deflate" | |
25 | + } | |
26 | + self.sql='SELECT id FROM customer_loan WHERE batch="2109000088";' | |
27 | + | |
28 | + | |
29 | + | |
30 | +# tt = generalCustomerLoan_enforce() | |
31 | +# re = hg.get(url = tt.url,headers = tt.header,proxies=hg.myproxies) | |
32 | +# print(re.json()) | |
33 | + | ... | ... |
commons/api/hg/loan_generalCustomer/generalCustomerLoan_list.py
... | ... | @@ -31,8 +31,8 @@ class generalCustomerLoan_list(): |
31 | 31 | "enforcerState": "1", |
32 | 32 | "customerId": 141995, |
33 | 33 | "batch": "2109000098", |
34 | - "settleDateStart": "2021-09-08", | |
35 | - "settleDateEnd": "2021-09-08" | |
34 | + "settleDateStart": "2020-09-08", | |
35 | + "settleDateEnd": "2025-09-08" | |
36 | 36 | } |
37 | 37 | |
38 | 38 | # tt = generalCustomerLoan_list() | ... | ... |
testcase/hg/loan_generalCustomer/test_generalCustomerLoan.py
... | ... | @@ -7,11 +7,13 @@ from commons.MySession import my,hg |
7 | 7 | from commons.api.hg.loan_generalCustomer.generalCustomerLoan_save import generalCustomerLoan_save |
8 | 8 | from commons.api.hg.loan_generalCustomer.generalCustomerLoan_delete import generalCustomerLoan_delete |
9 | 9 | from commons.api.hg.loan_generalCustomer.generalCustomerLoan_list import generalCustomerLoan_list |
10 | +from commons.api.hg.loan_generalCustomer.generalCustomerLoan_enforce import generalCustomerLoan_enforce | |
10 | 11 | from commons.basic.registerRecord_save import registerRecord_save |
11 | 12 | from commons.basic.createAndTrade import createAndTrade |
12 | 13 | g=generalCustomerLoan_save() |
13 | 14 | l=generalCustomerLoan_list() |
14 | 15 | d=generalCustomerLoan_delete() |
16 | +e=generalCustomerLoan_enforce() | |
15 | 17 | r=registerRecord_save() |
16 | 18 | c=createAndTrade() |
17 | 19 | |
... | ... | @@ -21,27 +23,33 @@ class test_generalCustomerLoan(unittest.TestCase): |
21 | 23 | |
22 | 24 | @classmethod |
23 | 25 | def setUpClass(cls) : |
24 | - #新增一个进门批号单 | |
25 | - re=hg.post(url=r.url,headers=r.header,json=r.body1) | |
26 | - #获取批号 | |
27 | - cls.batch=re.json()["data"]["batchCode"] | |
28 | - #普通客户使用进门批号生成交易单 | |
29 | - body=c.body1.copy() | |
30 | - body["orderItemList"][0]["batchCode"]=cls.batch | |
31 | - re1=hg.post(url=c.url,headers=c.header,json=body) | |
26 | + #存储进门的批次号 | |
27 | + cls.batch=[] | |
28 | + #生成两单进门批号 | |
29 | + for i in range(2): | |
30 | + #新增一个进门批号单 | |
31 | + re=hg.post(url=r.url,headers=r.header,json=r.body1) | |
32 | + #获取批号 | |
33 | + cls.batch.append(re.json()["data"]["batchCode"]) | |
34 | + #普通客户使用进门批号生成交易单 | |
35 | + body=c.body1.copy() | |
36 | + body["orderItemList"][0]["batchCode"]=cls.batch | |
37 | + re1=hg.post(url=c.url,headers=c.header,json=body) | |
32 | 38 | |
33 | 39 | |
34 | 40 | @unittest.case_mark(my.mark()) |
35 | 41 | def test_generalCustomerLoan_01_save(self): |
36 | 42 | "普通借款-新增预支款:根据批次号新增预支款" |
37 | - #替换批次号 | |
38 | - body=g.body.copy() | |
39 | - body["batch"]=self.batch | |
40 | - #请求 | |
41 | - re=hg.post(url=g.url,headers=g.header,json=body) | |
42 | - print(re.json(),"普通预付款批次号",self.batch) | |
43 | - self.assertEqual(re.status_code, 200) | |
44 | - self.assertTrue("操作成功" in str(re.json()).replace(" ","")) | |
43 | + #生成两个普通借款单 | |
44 | + for i in range(2): | |
45 | + #替换批次号 | |
46 | + body=g.body.copy() | |
47 | + body["batch"]=self.batch[i] | |
48 | + #请求 | |
49 | + re=hg.post(url=g.url,headers=g.header,json=body) | |
50 | + print(re.json(),"普通借款批次号",self.batch[i]) | |
51 | + self.assertEqual(re.status_code, 200) | |
52 | + self.assertTrue("操作成功" in str(re.json()).replace(" ","")) | |
45 | 53 | |
46 | 54 | |
47 | 55 | @unittest.skipDepend(depend="test_generalCustomerLoan_01_save") |
... | ... | @@ -50,16 +58,16 @@ class test_generalCustomerLoan(unittest.TestCase): |
50 | 58 | "普通借款-列表查询:执行状态,客户,批号和结算日期都输入合法值,查询指定借款数据" |
51 | 59 | #修改查询的值 |
52 | 60 | body=l.body.copy() |
53 | - body["batch"] = self.batch | |
54 | - body["settleDateStart"]=com.dates() | |
55 | - body["settleDateEnd"] = com.dates() | |
61 | + body["batch"] = self.batch[0] | |
62 | + # body["settleDateStart"]=com.dates() | |
63 | + # body["settleDateEnd"] = com.dates() | |
56 | 64 | #请求 |
57 | 65 | re=hg.post(url=l.url,headers=l.header,json=body) |
58 | 66 | print(re.json()) |
59 | 67 | #断言 |
60 | 68 | self.assertEqual(re.status_code, 200) |
61 | 69 | self.assertTrue("操作成功" in str(re.json()).replace(" ","")) |
62 | - self.assertTrue(self.batch in str(re.json()).replace(" ","")) | |
70 | + self.assertTrue(self.batch[0] in str(re.json()).replace(" ","")) | |
63 | 71 | |
64 | 72 | |
65 | 73 | @unittest.skipDepend(depend="test_generalCustomerLoan_01_save") |
... | ... | @@ -67,21 +75,35 @@ class test_generalCustomerLoan(unittest.TestCase): |
67 | 75 | def test_generalCustomerLoan_03_delete(self): |
68 | 76 | "普通借款-撤销:撤销一个未执行的借款单" |
69 | 77 | #查询批次号对应id |
70 | - batch_id=db.mysql_selectOne(d.sql.replace("2109000088",self.batch))[0] | |
78 | + batch_id=db.mysql_selectOne(d.sql.replace("2109000088",self.batch[0]))[0] | |
71 | 79 | #替换url的批次id |
72 | 80 | url=d.url.replace("66",str(batch_id)) |
73 | 81 | #请求 |
74 | 82 | re=hg.get(url=url,headers=d.header) |
75 | - print(re.json(),"普通预付款批次号id",batch_id) | |
83 | + print(re.json(),"删除的普通借款批次号号和id",self.batch[0],batch_id) | |
76 | 84 | #断言 |
77 | 85 | self.assertEqual(re.status_code, 200) |
78 | 86 | self.assertTrue("操作成功" in str(re.json()).replace(" ","")) |
79 | 87 | |
80 | 88 | |
89 | + @unittest.skipDepend(depend="test_generalCustomerLoan_01_save") | |
90 | + @unittest.case_mark(my.mark()) | |
91 | + def test_generalCustomerLoan_04_enforce(self): | |
92 | + "普通借款-执行:执行一个未执行的借款单" | |
93 | + #查询批次号对应id | |
94 | + batch_id=db.mysql_selectOne(d.sql.replace("2109000088",self.batch[1]))[0] | |
95 | + #替换url的批次id | |
96 | + url=e.url.replace("66",str(batch_id)) | |
97 | + #请求 | |
98 | + re=hg.get(url=url,headers=e.header) | |
99 | + print(re.json(),"执行的普通借款批次号号和id",self.batch[1],batch_id) | |
100 | + #断言 | |
101 | + self.assertEqual(re.status_code, 200) | |
102 | + self.assertTrue("操作成功" in str(re.json()).replace(" ","")) | |
81 | 103 | |
82 | 104 | |
83 | 105 | |
84 | 106 | if __name__ == "__main__": |
85 | 107 | |
86 | - # unittest.main(verbosity=2) | |
87 | - com.run_one(test_generalCustomerLoan("test_generalCustomerLoan_01_save")) | |
108 | + unittest.main(verbosity=2) | |
109 | + # com.run_one(test_generalCustomerLoan("test_generalCustomerLoan_01_save")) | ... | ... |