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



class test_weighingServiceSave(unittest.TestCase):
    "哈尔滨市场-称重服务"

    @classmethod
    def setUpClass(cls):
        pass

    def setUp(self) :
        we.refresh_commit_token()

    @unittest.case_mark(my.mark())
    def test_weighingServiceSave_01(self):
        "称重服务:成功新增一条称重服务单"
        body=we.body.copy()
        car=li.car_list()["data"]
        body["carTypeId"]=car[0]["id"]
        body["carTypeName"]=car[0]["carTypeName"]
        body["carTypeCode"]=car[0]["code"]
        re=heb.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_list([test_weighingServiceSave("test_weighingServiceSave_01"),test_weighingServiceSave("test_weighingServiceSave_02")])