test_weightBizBill_doRefund.py
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
import urllib3
from commons import common as com
from commons import ConfigDB as db
from commons.MySession import my,sy1
from commons.api.weightBizBill_doRefund import weightBizBill_doRefund
from commons.api.weighingServiceSave import weighingServiceSave
from commons.basic.listCarType import listCarType
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
do=weightBizBill_doRefund()
ad=weighingServiceSave(sy1)
ca=listCarType(sy1)
class test_weightBizBill_doRefund(unittest.TestCase):
"称重服务单列表"
def setUp(self):
"数据准备:新增一条称重单"
body=ad.body.copy()
body["carTypeId"]=ca.car_list()["data"][0]["id"]
body["carTypeName"]=ca.car_list()["data"][0]["carTypeName"]
body["carTypeCode"]=ca.car_list()["data"][0]["code"]
self.re=sy1.post(url=ad.url,headers=ad.header,json=body)
@unittest.case_mark(my.mark())
def test_weightBizBill_doRefund_01(self):
"称重服务单列表-退款:成功退款一个现金交费的称重单"
body=do.body.replace("206",str(self.re.json()["data"]["id"]))
re=sy1.post(url=do.url,headers=do.header,data=body.encode('utf-8'))
print(re.json())
#获取退款后称重单的状态,3为已退款
bill_status=db.mysql_selectOne(
"SELECT status FROM `weight_biz_bill` WHERE id={};".format(self.re.json()["data"]["id"]))[0]
self.assertEqual(re.status_code, 200)
self.assertTrue("'result':'操作成功!'" in str(re.json()).replace(" ",""))
self.assertEqual(bill_status ,3)
if __name__ == "__main__":
unittest.main(verbosity=2)
# com.run_one(test_weightBizBill_listPage("test_weightBizBill_listPage_01"))