Commit c9571dbfdcce1f7264656bc26afbcc609e3b452b
1 parent
0836734c
上传用例
Showing
10 changed files
with
296 additions
and
17 deletions
commons/api/hg/loan_vipCustomer/getSingleWithoutValidate.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 | + | ||
12 | +from commons.MySession import hg | ||
13 | + | ||
14 | +class getSingleWithoutValidate(): | ||
15 | + | ||
16 | + def __init__(self): | ||
17 | + self.url = "http://test.gateway.diligrp.com:8285/account-service/api/account/getSingleWithoutValidate" | ||
18 | + self.header = { | ||
19 | + "Connection" :"keep-alive", | ||
20 | + "Content-Length" :"25", | ||
21 | + "Accept" :"application/json, text/plain, */*", | ||
22 | + "UAP_accessToken" :".-.--", | ||
23 | + "ignoreCancelToken" :"true", | ||
24 | + "UAP_refreshToken" :".-.--", | ||
25 | + "Content-Type" :"application/json;charset=UTF-8", | ||
26 | + "Accept-Language" :"zh-CN,zh;q=0.9", | ||
27 | + "Accept-Encoding" :"gzip, deflate" | ||
28 | + } | ||
29 | + self.body = {"cardNo":"888810026785"} | ||
30 | + | ||
31 | + | ||
32 | +# tt = getSingleWithoutValidate() | ||
33 | +# re = hg.post(url = tt.url,json = tt.body,headers = tt.header,proxies=hg.myproxies) | ||
34 | +# print(re.json()) |
commons/api/hg/loan_vipCustomer/specialLoanQuery.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 | + | ||
12 | +from commons.MySession import hg | ||
13 | + | ||
14 | +class specialLoanQuery(): | ||
15 | + | ||
16 | + def __init__(self): | ||
17 | + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/aggregation/specialLoanQuery" | ||
18 | + self.header = { | ||
19 | + "Connection" :"keep-alive", | ||
20 | + "Accept" :"application/json, text/plain, */*", | ||
21 | + "UAP_accessToken" :".-.--", | ||
22 | + "ignoreCancelToken" :"true", | ||
23 | + "UAP_refreshToken" :".-.--", | ||
24 | + "Content-Type" :"application/json;charset=UTF-8", | ||
25 | + "Accept-Language" :"zh-CN,zh;q=0.9", | ||
26 | + "Accept-Encoding" :"gzip, deflate" | ||
27 | + } | ||
28 | + self.body = {"accountId":107792,"tradeDateStart":"2021-09-07","tradeDateEnd":"2021-09-07","customerId":141992} | ||
29 | + | ||
30 | + | ||
31 | +tt = specialLoanQuery() | ||
32 | +re = hg.post(url = tt.url,json = tt.body,headers = tt.header,proxies=hg.myproxies) | ||
33 | +print(re.json()) | ||
34 | + |
commons/api/hg/loan_vipCustomer/vipCustomerLoan_details.py
commons/api/hg/loan_vipCustomer/vipCustomerLoan_list.py
commons/api/hg/loan_vipCustomer/vipCustomerLoan_save.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 | + | ||
12 | +from commons.MySession import hg | ||
13 | + | ||
14 | +class vipCustomerLoan_save(): | ||
15 | + | ||
16 | + def __init__(self): | ||
17 | + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/vipCustomerLoan/save" | ||
18 | + self.header = { | ||
19 | + "Connection" :"keep-alive", | ||
20 | + "Content-Length" :"25", | ||
21 | + "Accept" :"application/json, text/plain, */*", | ||
22 | + "UAP_accessToken" :".-.--", | ||
23 | + "ignoreCancelToken" :"true", | ||
24 | + "UAP_refreshToken" :".-.--", | ||
25 | + "Content-Type" :"application/json;charset=UTF-8", | ||
26 | + "Accept-Language" :"zh-CN,zh;q=0.9", | ||
27 | + "Accept-Encoding" :"gzip, deflate" | ||
28 | + } | ||
29 | + self.body = {"accountId":107792,"tradeDateStart":"2021-09-07","tradeDateEnd":"2021-09-07","customerId":141992,"customerName":"特朗普vip","customerAccountId":107792,"customerIdcard":"110101198001012390","customerCode":"00131694"} | ||
30 | + self.sql= "SELECT balance*0.01 FROM dili_upay.`upay_fund_account` where account_id = 107792;" | ||
31 | + | ||
32 | +# tt = getSingleWithoutValidate() | ||
33 | +# re = hg.post(url = tt.url,json = tt.body,headers = tt.header,proxies=hg.myproxies) | ||
34 | +# print(re.json()) |
commons/basic/createAndTrade.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 | + | ||
12 | +from commons.MySession import hg | ||
13 | + | ||
14 | +class createAndTrade(): | ||
15 | + | ||
16 | + def __init__(self): | ||
17 | + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/createAndTrade" | ||
18 | + self.header = { | ||
19 | + "UAP_accessToken":"demo", | ||
20 | + "UAP_refreshToken":"demo", | ||
21 | + "Content-Type":"application/json;charset=utf-8"} | ||
22 | + # 大客户body | ||
23 | + self.body = {"sellerId":141992,"sellerName":"特朗普vip","sellerAccountId":107792,"sellerCardNo":"888810026785","buyerId":141995,"buyerName":"拜登","buyerAccountId":107791,"buyerCardNo":"888810043394","posCode":"666","tradePassword":"111111","orderItemList":[{"number":0,"batchCode":"2109000067","productId":125,"productCode":"374690","productName":"苹果","categoryId":374690,"weightType":1,"quantity":1,"pieceWeight":1,"grossWeight":0,"tareWeight":0,"weight":1,"price":2000,"PriceStr":"20","amount":2000,"amountStr":20.0,"originId":510100,"originName":"成都市","feeItemList":[{"type":1,"chargeItemId":521,"chargeItemName":"买家手续费","amount":550.0},{"type":2,"chargeItemId":522,"chargeItemName":"卖家手续费","amount":989.00}]}]} | ||
24 | + #普通客户body | ||
25 | + self.body1={"sellerId":141995,"sellerName":"拜登","sellerAccountId":107791,"sellerCardNo":"888810043394","buyerId":141992,"buyerName":"特朗普vip","buyerAccountId":107792,"buyerCardNo":"888810026785","posCode":"666","tradePassword":"111111","orderItemList":[{"number":0,"batchCode":"2109000073","productId":125,"productCode":"374690","productName":"苹果","categoryId":374690,"weightType":1,"quantity":1,"pieceWeight":1,"grossWeight":0,"tareWeight":0,"weight":1,"price":2000,"PriceStr":"20","amount":2000,"amountStr":20.0,"originId":510100,"originName":"成都市","feeItemList":[{"type":1,"chargeItemId":521,"chargeItemName":"买家手续费","amount":550.0},{"type":2,"chargeItemId":522,"chargeItemName":"卖家手续费","amount":989.00}]}]} | ||
26 | + | ||
27 | + | ||
28 | +# tt = createAndTrade() | ||
29 | +# re = hg.post(url = tt.url,json = tt.body,headers = tt.header,proxies=hg.myproxies) | ||
30 | +# print(re.json()) | ||
0 | \ No newline at end of file | 31 | \ No newline at end of file |
commons/basic/registerRecord_save.py
@@ -17,6 +17,7 @@ class registerRecord_save(): | @@ -17,6 +17,7 @@ class registerRecord_save(): | ||
17 | "UAP_firmId" :"15", | 17 | "UAP_firmId" :"15", |
18 | "Content-Type" :"application/json", | 18 | "Content-Type" :"application/json", |
19 | "Host" :"test.gateway.diligrp.com:8285"} | 19 | "Host" :"test.gateway.diligrp.com:8285"} |
20 | + # 大客户body | ||
20 | self.body = { | 21 | self.body = { |
21 | "accountId": 107792, | 22 | "accountId": 107792, |
22 | "cardNo": "888810026785", | 23 | "cardNo": "888810026785", |
@@ -59,27 +60,27 @@ class registerRecord_save(): | @@ -59,27 +60,27 @@ class registerRecord_save(): | ||
59 | }], | 60 | }], |
60 | "registerFeeDtoList": [], | 61 | "registerFeeDtoList": [], |
61 | "tradePassword": "" } | 62 | "tradePassword": "" } |
62 | - | 63 | + #普通客户body |
63 | self.body1 = { | 64 | self.body1 = { |
64 | - "accountId": 107792, | ||
65 | - "cardNo": "888810026785", | ||
66 | - "customerId": 141992, | ||
67 | - "customerCode": "00131694", | ||
68 | - "customerName": "特朗普vip", | 65 | + "accountId": 107791, |
66 | + "cardNo": "888810043394", | ||
67 | + "customerId": 141995, | ||
68 | + "customerCode": "00131697", | ||
69 | + "customerName": "拜登", | ||
69 | "fixedphoneNumber": None, | 70 | "fixedphoneNumber": None, |
70 | - "mobilephoneNumber": "16111111112", | 71 | + "mobilephoneNumber": "16111111113", |
71 | "identityCardAddress": "", | 72 | "identityCardAddress": "", |
72 | - "identityCardNo": "110101198001012390", | 73 | + "identityCardNo": "110101198001012331", |
73 | "identityCardType": "ID", | 74 | "identityCardType": "ID", |
74 | "registerDetailDtoList": [{ | 75 | "registerDetailDtoList": [{ |
75 | "id": 0, | 76 | "id": 0, |
76 | "areaId": 274, | 77 | "areaId": 274, |
77 | "areaName": "东区01", | 78 | "areaName": "东区01", |
78 | - "quantity": 10, | 79 | + "quantity": 1000, |
79 | "productId": 374690, | 80 | "productId": 374690, |
80 | "registerRecordId": 0, | 81 | "registerRecordId": 0, |
81 | "remark": None, | 82 | "remark": None, |
82 | - "weight": 10, | 83 | + "weight": 1000, |
83 | "weightType": 0, | 84 | "weightType": 0, |
84 | "created": None, | 85 | "created": None, |
85 | "createdById": 0, | 86 | "createdById": 0, |
@@ -101,10 +102,11 @@ class registerRecord_save(): | @@ -101,10 +102,11 @@ class registerRecord_save(): | ||
101 | } | 102 | } |
102 | }], | 103 | }], |
103 | "registerFeeDtoList": [], | 104 | "registerFeeDtoList": [], |
104 | - "tradePassword": "" } | 105 | + "tradePassword": "" |
106 | + } | ||
105 | 107 | ||
106 | 108 | ||
107 | 109 | ||
108 | -tt=registerRecord_save() | ||
109 | -re=hg.post(url=tt.url,headers=tt.header,json=tt.body,proxies=hg.myproxies) | ||
110 | -print(str(re.json())) | ||
111 | \ No newline at end of file | 110 | \ No newline at end of file |
111 | +# tt=registerRecord_save() | ||
112 | +# re=hg.post(url=tt.url,headers=tt.header,json=tt.body1,proxies=hg.myproxies) | ||
113 | +# print(str(re.json())) | ||
112 | \ No newline at end of file | 114 | \ No newline at end of file |
commons/common.py
@@ -3,6 +3,8 @@ | @@ -3,6 +3,8 @@ | ||
3 | import os | 3 | import os |
4 | import configparser | 4 | import configparser |
5 | import unittest | 5 | import unittest |
6 | +import time | ||
7 | +from datetime import timedelta,date | ||
6 | from discover import DiscoveringTestLoader | 8 | from discover import DiscoveringTestLoader |
7 | from commons.Logging import log | 9 | from commons.Logging import log |
8 | 10 | ||
@@ -119,4 +121,86 @@ def mylog(func): | @@ -119,4 +121,86 @@ def mylog(func): | ||
119 | def RebackTest(self): | 121 | def RebackTest(self): |
120 | log.info("{}".format(func.__name__)) | 122 | log.info("{}".format(func.__name__)) |
121 | return func(self) | 123 | return func(self) |
122 | - return RebackTest | ||
123 | \ No newline at end of file | 124 | \ No newline at end of file |
125 | + return RebackTest | ||
126 | + | ||
127 | +def date_time_chinese(): | ||
128 | + "returns the current time string,format for YYYY年mm月dd日HH时MM分SS秒" | ||
129 | + return time.strftime("%Y年%m月%d日 %H时%M分%S秒".decode('utf-8').encode('gbk'),time.localtime()) | ||
130 | + | ||
131 | + | ||
132 | +def date_chinese(): | ||
133 | + "returns the current time string, format for YYYY年mm月dd日" | ||
134 | + return time.strftime("%Y年%m月%d日".decode('utf-8').encode('gbk'),time.localtime()) | ||
135 | + | ||
136 | +def time_chinese(): | ||
137 | + "returns the current time string,format for HH时 MM分 SS秒" | ||
138 | + return time.strftime("%H时%M分%S秒".decode('utf-8').encode('gbk'),time.localtime()) | ||
139 | + | ||
140 | +def date_time(): | ||
141 | + "returns the current time string, format for YYYY-mm-dd HH:MM:SS" | ||
142 | + return time.strftime("%Y-%m-%d %H:%M:%S",time.localtime()) | ||
143 | + | ||
144 | +def date_time_slash(): | ||
145 | + "returns the current time string,format for YYYY/mm/dd HH:MM:SS" | ||
146 | + return time.strftime("%Y/%m/%d %H:%M:%S",time.localtime()) | ||
147 | + | ||
148 | +def dates(): | ||
149 | + "returns the current time string,format for YYYY-mm-dd" | ||
150 | + return time.strftime("%Y-%m-%d",time.localtime()) | ||
151 | + | ||
152 | +def date_slash(): | ||
153 | + "returns the current time string,format for YYYY/mm/dd" | ||
154 | + return time.strftime("%Y/%m/%d",time.localtime()) | ||
155 | + | ||
156 | +def times(): | ||
157 | + "returns the current time string, format for HH:MM:SS" | ||
158 | + return time.strftime("%H:%M:%S",time.localtime()) | ||
159 | + | ||
160 | +def year(): | ||
161 | + "returns the current time string,format for year" | ||
162 | + return time.strftime("%Y",time.localtime()) | ||
163 | + | ||
164 | +def month(): | ||
165 | + "returns the current time string,format for month" | ||
166 | + return time.strftime("%m",time.localtime()) | ||
167 | + | ||
168 | +def day(): | ||
169 | + "returns the current time string,format for day" | ||
170 | + return time.strftime("%d",time.localtime()) | ||
171 | + | ||
172 | +def hour(): | ||
173 | + "returns the current time string, format for Hour" | ||
174 | + return time.strftime("%H",time.localtime()) | ||
175 | + | ||
176 | +def minute(): | ||
177 | + "returns the current time string,format for minute" | ||
178 | + return time.strftime("%M",time.localtime()) | ||
179 | + | ||
180 | +def seconds(): | ||
181 | + "return the current time string,format for seconds" | ||
182 | + return time.strftime("%S",time.localtime()) | ||
183 | + | ||
184 | +def str_to_tuple(stime): | ||
185 | + "returns the string variable into time tuples" | ||
186 | + return time.strptime(stime,"%Y-%m-%d %H:%M:%S") | ||
187 | + | ||
188 | +def add_date(day_num): | ||
189 | + today=date.today() | ||
190 | + print("returns the current date-%s and a time interval-%s" %(today,day_num)) | ||
191 | + times=today+timedelta(days=day_num) | ||
192 | + return times | ||
193 | + | ||
194 | +def sub_date(day_num): | ||
195 | + today=date.today() | ||
196 | + print("returns the current date-%s minus one time interval-%s" %(today,day_num)) | ||
197 | + times=today-timedelta(days=day_num) | ||
198 | + return times | ||
199 | + | ||
200 | +def time_stamp(): | ||
201 | + #返回时间戳 | ||
202 | + t=time.time() | ||
203 | + # print (t) #原始时间数据 | ||
204 | + # print (int(t)) #秒级时间戳 | ||
205 | + # print (int(round(t * 1000))) #毫秒级时间戳 | ||
206 | + # print (int(round(t * 1000000))) #微秒级时间戳 | ||
207 | + return int(round(t * 1000)) |
testcase/hg/loan_vipCustomer/test_getSingleWithoutValidate.py
0 → 100644
1 | +#!/usr/bin/python | ||
2 | +# -*- coding: UTF-8 -*- | ||
3 | +import unittest | ||
4 | +from commons import common as com | ||
5 | +from commons.MySession import my,hg | ||
6 | +from commons.api.hg.loan_vipCustomer.getSingleWithoutValidate import getSingleWithoutValidate | ||
7 | +g=getSingleWithoutValidate() | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | +class test_getSingleWithoutValidate(unittest.TestCase): | ||
12 | + "杭果市场-借款管理-大客户借款" | ||
13 | + | ||
14 | + @unittest.case_mark(my.mark()) | ||
15 | + def test_getSingleWithoutValidate_01(self): | ||
16 | + "大客户借款-新增-刷卡:刷卡查询园区卡信息" | ||
17 | + re=hg.post(url=g.url,headers=g.header,json=g.body) | ||
18 | + print(re.json()) | ||
19 | + self.assertEqual(re.status_code, 200) | ||
20 | + self.assertTrue("'特朗普vip'" in str(re.json()).replace(" ","")) | ||
21 | + | ||
22 | + | ||
23 | +if __name__ == "__main__": | ||
24 | + | ||
25 | + unittest.main(verbosity=2) | ||
26 | + | ||
27 | + # com.run_one(test_weightBizBill_listPage("test_weightBizBill_listPage_01")) |
testcase/hg/loan_vipCustomer/test_specialLoanQuery.py
0 → 100644
1 | +#!/usr/bin/python | ||
2 | +# -*- coding: UTF-8 -*- | ||
3 | +import unittest | ||
4 | +from commons import common as com | ||
5 | +from commons.MySession import my,hg | ||
6 | +from commons.api.hg.loan_vipCustomer.specialLoanQuery import specialLoanQuery | ||
7 | +s=specialLoanQuery() | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | +class test_specialLoanQuery(unittest.TestCase): | ||
12 | + "杭果市场-借款管理-大客户借款" | ||
13 | + | ||
14 | + @unittest.case_mark(my.mark()) | ||
15 | + def test_specialLoanQuery_01(self): | ||
16 | + "大客户借款-新增-查询:查询客户的订单信息" | ||
17 | + #获取当天时间 | ||
18 | + body=s.body.copy() | ||
19 | + body["tradeDateStart"]=com.dates() | ||
20 | + body["tradeDateEnd"] = com.dates() | ||
21 | + re=hg.post(url=s.url,headers=s.header,json=s.body) | ||
22 | + print(re.json()) | ||
23 | + data=["未查询到交易信息","操作成功","该时间段已发生过预支借款,若还需要借款,请更改借款交易时间"] | ||
24 | + self.assertEqual(re.status_code, 200) | ||
25 | + if any(t in str(re.json()).replace(" ","") for t in data): | ||
26 | + assert True | ||
27 | + else: | ||
28 | + assert False | ||
29 | + | ||
30 | +if __name__ == "__main__": | ||
31 | + | ||
32 | + unittest.main(verbosity=2) | ||
33 | + | ||
34 | + # com.run_one(test_weightBizBill_listPage("test_weightBizBill_listPage_01")) |