test_weighingServiceSave.py 1.53 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
import urllib3
from commons import common as com
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(sy1)
li=listCarType(sy1)



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):
        "称重服务:成功新增一条称重服务单"
        print(self.__doc__)
        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=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(" ",""))

    @unittest.case_mark(my.mark())
    def test_weighingServiceSave_02(self):
        "称重服务:成功新增一条称重服务单"
        print("11111111111111111111111111111111111")

if __name__ == "__main__":

    # unittest.main(verbosity=2)

    com.run_list([test_weighingServiceSave("test_weighingServiceSave_01"),test_weighingServiceSave("test_weighingServiceSave_02")])