test_weightBizBill_doRefund.py
1.82 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
47
48
49
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
import urllib3
from commons import ConfigDB as db
from commons.MySession import my,heb
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(heb)
ca=listCarType(heb)
class test_weightBizBill_doRefund(unittest.TestCase):
"哈尔滨市场-称重服务-称重服务单列表"
def setUp(self):
"数据准备:新增一条称重单"
#刷新增防重码
ad.refresh_commit_token()
#新增称重单
body=ad.body.copy()
car=ca.car_list()["data"]
body["carTypeId"]=car[0]["id"]
body["carTypeName"]=car[0]["carTypeName"]
body["carTypeCode"]=car[0]["code"]
self.re=heb.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=heb.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"))