test_weighingServiceSave.py 1.14 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
import urllib3
from commons.MySession import my,sy1
from commons.api.weighingServiceSave import weighingServiceSave
from commons.basic.listCarType import listCarType
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
we=weighingServiceSave()
li=listCarType()



class test_weighingServiceSave(unittest.TestCase):
    "称重服务"

    @unittest.case_mark(my.mark())
    def test_weighingServiceSave_01(self):
        "称重服务-称重服务:成功新增一条称重服务单"
        body=we.body.copy()
        body["carTypeId"]=li.car_list()["data"][0]["id"]
        body["carTypeName"]=li.car_list()["data"][0]["carTypeName"]
        body["carTypeCode"]=li.car_list()["data"][0]["code"]
        re=sy1.post(url=we.url,headers=we.header,json=body)
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'message':'交费成功','result':'交费成功','success':True" in str(re.json()).replace(" ",""))


if __name__ == "__main__":

    unittest.main(verbosity=2)

    # com.run_one(test_weighingServiceSave("test_weighingServiceSave_01"))