Commit 6423fad11534f48a0f2e7e56a746c784f7481909
1 parent
5f8af56a
结算优化
Showing
1 changed file
with
21 additions
and
11 deletions
testcase/FeedbackOrderController/test_feedback_order_settlement.py
1 | +import json | ||
1 | import unittest | 2 | import unittest |
2 | import urllib3 | 3 | import urllib3 |
3 | from commons.MySession import my,sy1 | 4 | from commons.MySession import my,sy1 |
4 | from commons.api.feedback_order_settlement import feedback_order_settlement | 5 | from commons.api.feedback_order_settlement import feedback_order_settlement |
5 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | 6 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
6 | from commons.api.feedback_order_settlement_query import feedback_order_settlement_query | 7 | from commons.api.feedback_order_settlement_query import feedback_order_settlement_query |
7 | -import random | ||
8 | fosq = feedback_order_settlement_query() | 8 | fosq = feedback_order_settlement_query() |
9 | 9 | ||
10 | fos = feedback_order_settlement() | 10 | fos = feedback_order_settlement() |
@@ -18,28 +18,37 @@ class test_feedback_order_settlement(unittest.TestCase): | @@ -18,28 +18,37 @@ class test_feedback_order_settlement(unittest.TestCase): | ||
18 | def setUp(self): | 18 | def setUp(self): |
19 | body = fosq.body.replace("feedbackCustomerId=25", "feedbackCustomerId=16").replace("2021-07-22 00:00:00", "\ | 19 | body = fosq.body.replace("feedbackCustomerId=25", "feedbackCustomerId=16").replace("2021-07-22 00:00:00", "\ |
20 | 2021-07-03 00:00:00").replace("2021-08-03 23:59:59","2021-08-03 23:59:59") | 20 | 2021-07-03 00:00:00").replace("2021-08-03 23:59:59","2021-08-03 23:59:59") |
21 | - re = sy1.post(url=fosq.url, data=body, headers=fosq.header) | ||
22 | - # self.id = re.json()["rows"][0]["id"] | 21 | + re = sy1.post(url = fosq.url, data = body, headers = fosq.header) |
22 | + | ||
23 | self.Amount = re.json()["rows"][0]["unsettledAmount"] | 23 | self.Amount = re.json()["rows"][0]["unsettledAmount"] |
24 | self.ids = re.json()["rows"][0]["id"] | 24 | self.ids = re.json()["rows"][0]["id"] |
25 | self.billIds = re.json()["rows"][0]["billId"] | 25 | self.billIds = re.json()["rows"][0]["billId"] |
26 | # | 26 | # |
27 | - # elf.name = re.json()["rows"][0]["name"] | ||
28 | - | 27 | + url = "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/settleAccount.action" |
28 | + header = { | ||
29 | + "X-Requested-With": "XMLHttpRequest", | ||
30 | + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36", | ||
31 | + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" | ||
32 | + } | ||
33 | + body = "customerId=16" | ||
34 | + re2 = sy1.post(url = url,headers = header,data = body) | ||
35 | + self.id = re2.json()["id"] | ||
36 | + self.name = re2.json()["name"] | ||
37 | + self.cardNumber = re2.json()["cardNumber"] | ||
29 | 38 | ||
30 | def test_feedback_order_settlement_01(self): | 39 | def test_feedback_order_settlement_01(self): |
31 | - body = fos.body.replace("id=25","id=25").replace("888810057654","888810057654")\ | 40 | + body = fos.body.replace("id=25","id="+str(self.id)).replace("888810057654",str(self.cardNumber))\ |
32 | .replace("settleAmount=2","settleAmount="+str(self.Amount)).\ | 41 | .replace("settleAmount=2","settleAmount="+str(self.Amount)).\ |
33 | replace("ids=12034","ids="+str(self.ids)).\ | 42 | replace("ids=12034","ids="+str(self.ids)).\ |
34 | - replace("feedbackCustomerId=25","feedbackCustomerId=25").\ | ||
35 | - replace("feedbackCustomerName=验证员工推送到CRM","feedbackCustomerName=验证员工推送到CRM").\ | 43 | + replace("feedbackCustomerId=25","feedbackCustomerId="+str(self.id)).\ |
44 | + replace("feedbackCustomerName=验证员工推送到CRM","feedbackCustomerName="+str(self.name)).\ | ||
36 | replace("billIds=3621","billIds="+str(self.billIds)).\ | 45 | replace("billIds=3621","billIds="+str(self.billIds)).\ |
37 | replace("settledAmounts=2","settledAmounts="+str(self.Amount)) | 46 | replace("settledAmounts=2","settledAmounts="+str(self.Amount)) |
38 | - print(body) | 47 | + # print(body) |
39 | re = sy1.post(url = fos.url, headers = fos.header, data = body.encode('utf-8')) | 48 | re = sy1.post(url = fos.url, headers = fos.header, data = body.encode('utf-8')) |
40 | - print(re.headers) | 49 | + # print(re.headers) |
41 | 50 | ||
42 | - print(re.json()) | 51 | + # print(re.json()) |
43 | self.assertTrue("操作成功" in str(re.json())) | 52 | self.assertTrue("操作成功" in str(re.json())) |
44 | return re | 53 | return re |
45 | 54 | ||
@@ -49,4 +58,4 @@ class test_feedback_order_settlement(unittest.TestCase): | @@ -49,4 +58,4 @@ class test_feedback_order_settlement(unittest.TestCase): | ||
49 | 58 | ||
50 | 59 | ||
51 | if __name__ == '__main__': | 60 | if __name__ == '__main__': |
52 | - unittest.main() | 61 | - unittest.main() |
62 | + unittest.main() | ||
53 | \ No newline at end of file | 63 | \ No newline at end of file |