Commit 574c38f233b1b44623e5bc43f7bc1ab730700a5d
1 parent
7fb5b2fb
更新进门称重的方法
Showing
4 changed files
with
78 additions
and
7 deletions
commons/api/weightBizBill_doRefund.py
0 → 100644
1 | +#!/usr/bin/python | |
2 | +# -*- coding: UTF-8 -*- | |
3 | +import urllib3 | |
4 | +from commons import common as com | |
5 | +from commons.MySession import my,sy1 | |
6 | +from commons.basic.duplicateToken import duplicateToken | |
7 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
8 | + | |
9 | + | |
10 | +class weightBizBill_doRefund(): | |
11 | + url = "http://test.jmsf.diligrp.com:8385/weightBizBill/doRefund.action" | |
12 | + header = { | |
13 | + "Connection": "keep-alive", | |
14 | + "Accept": "application/json, text/javascript, */*; q=0.01", | |
15 | + "X-Requested-With": "XMLHttpRequest", | |
16 | + "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36", | |
17 | + "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", | |
18 | + "Accept-Language": "zh-CN,zh;q=0.9", | |
19 | + "Accept-Encoding": "gzip, deflate"} | |
20 | + body = "id=206&reason=退款原因_test_123" | |
21 | + | |
22 | + def __init__(self): | |
23 | + self.url = weightBizBill_doRefund.url.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
24 | + self.header = weightBizBill_doRefund.header | |
25 | + self.body = weightBizBill_doRefund.body | |
26 | + | |
27 | + | |
28 | + | |
29 | +# tt=weightBizBill_listPage() | |
30 | +# re=sy1.post(url=tt.url,headers=tt.header,json=tt.body,proxies=my.myproxies) | |
31 | +# print(re.json()) | |
0 | 32 | \ No newline at end of file | ... | ... |
config/global_data.conf
testcase/CZFW/test_weightBizBill_doRefund.py
0 → 100644
1 | +#!/usr/bin/python | |
2 | +# -*- coding: UTF-8 -*- | |
3 | +import unittest | |
4 | +import urllib3 | |
5 | +from commons import common as com | |
6 | +from commons import ConfigDB as db | |
7 | +from commons.MySession import my,sy1 | |
8 | +from commons.api.weightBizBill_doRefund import weightBizBill_doRefund | |
9 | +from commons.api.weighingServiceSave import weighingServiceSave | |
10 | +from commons.basic.listCarType import listCarType | |
11 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
12 | +do=weightBizBill_doRefund() | |
13 | +ad=weighingServiceSave(sy1) | |
14 | +ca=listCarType(sy1) | |
15 | + | |
16 | + | |
17 | +class test_weightBizBill_doRefund(unittest.TestCase): | |
18 | + "称重服务单列表" | |
19 | + | |
20 | + | |
21 | + def setUp(self): | |
22 | + "数据准备:新增一条称重单" | |
23 | + body=ad.body.copy() | |
24 | + body["carTypeId"]=ca.car_list()["data"][0]["id"] | |
25 | + body["carTypeName"]=ca.car_list()["data"][0]["carTypeName"] | |
26 | + body["carTypeCode"]=ca.car_list()["data"][0]["code"] | |
27 | + self.re=sy1.post(url=ad.url,headers=ad.header,json=body) | |
28 | + | |
29 | + @unittest.case_mark(my.mark()) | |
30 | + def test_weightBizBill_doRefund_01(self): | |
31 | + "称重服务单列表-退款:成功退款一个现金交费的称重单" | |
32 | + body=do.body.replace("206",str(self.re.json()["data"]["id"])) | |
33 | + re=sy1.post(url=do.url,headers=do.header,data=body.encode('utf-8')) | |
34 | + print(re.json()) | |
35 | + #获取退款后称重单的状态,3为已退款 | |
36 | + bill_status=db.mysql_selectOne( | |
37 | + "SELECT status FROM `weight_biz_bill` WHERE id={};".format(self.re.json()["data"]["id"]))[0] | |
38 | + self.assertEqual(re.status_code, 200) | |
39 | + self.assertTrue("'result':'操作成功!'" in str(re.json()).replace(" ","")) | |
40 | + self.assertEqual(bill_status ,3) | |
41 | + | |
42 | +if __name__ == "__main__": | |
43 | + | |
44 | + unittest.main(verbosity=2) | |
45 | + | |
46 | + # com.run_one(test_weightBizBill_listPage("test_weightBizBill_listPage_01")) | ... | ... |
testcase/CZFW/test_weightBizBill_listPage.py
... | ... | @@ -24,7 +24,6 @@ class test_weightBizBill_listPage(unittest.TestCase): |
24 | 24 | body["carTypeName"]=ca.car_list()["data"][0]["carTypeName"] |
25 | 25 | body["carTypeCode"]=ca.car_list()["data"][0]["code"] |
26 | 26 | self.re=sy1.post(url=ad.url,headers=ad.header,json=body) |
27 | - print(self.re.json()) | |
28 | 27 | |
29 | 28 | @unittest.case_mark(my.mark()) |
30 | 29 | def test_weightBizBill_listPage_01(self): |
... | ... | @@ -39,11 +38,6 @@ class test_weightBizBill_listPage(unittest.TestCase): |
39 | 38 | self.assertTrue(self.re.json()["data"]["number"] in str(re.json()).replace(" ","")) |
40 | 39 | |
41 | 40 | |
42 | - @classmethod | |
43 | - def tearDownClass(cls): | |
44 | - pass | |
45 | - | |
46 | - | |
47 | 41 | if __name__ == "__main__": |
48 | 42 | |
49 | 43 | unittest.main(verbosity=2) | ... | ... |