test_HP.py 2.68 KB
# -*- coding: utf-8 -*-

# @Time    : 2021/8/12 17:34
# @Author  : Ljq
# @File    : test_HP.py
# @Software: PyCharm

"""
回皮功能接口测试
"""

import json
import unittest
from commons.scripts.readConf import rC
from commons.api import zcApi as zcA
from commons.api.entranceFeeBillList import entranceFeeBillList as eFBL
from commons.api import hpApi
import time,random

class test_ZCCreate(unittest.TestCase):
    """整车-创建整车进门单"""
    def setUp(self) -> None:
        pass

    def tearDown(self) -> None:
        pass


    @classmethod
    def setUpClass(cls) -> None:
        cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost")
        cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost")
        cls.ic = rC.returnOptionsItems("testInfo", "cardNumRe")

    @classmethod
    def tearDownClass(cls) -> None:
        pass

    def test_hp(self):
        plate = f"川B{random.randint(10000,99999)}"
        goods = "雪莲果"
        cre_res = zcA.create_jmsf(host=self.gatewayHost,plate=plate,keyword=goods)
        print(cre_res.json())
        number = cre_res.json()["data"]["number"]
        aa = eFBL.do_freezeOrder(host=self.jmsfHost,attrValue=number)
        res,tareWeight = hpApi.do_backSkinWeighSave(host=self.gatewayHost,number=number)
        assert res.json()["code"]=="200","回皮失败"
        assert "data" in res.text,"回皮失败"

    def test_SearchByPlate(self):
        plate = f"川B{random.randint(10000,99999)}"
        goods="火龙果"
        cre_res = zcA.create_jmsf(host=self.gatewayHost,plate=plate,keyword=goods)
        print(cre_res.json())
        number = cre_res.json()["data"]["number"]
        aa = eFBL.do_freezeOrder(host=self.jmsfHost,attrValue=number)
        res = hpApi.get_listBackSkinTrucks(host=self.gatewayHost,plate=plate)
        print(res.json())
        assert res.json()["code"]=="200","车号查询失败"
        assert res.json()["data"][-1]["number"]==number,"车号查询失败"

    def test_SearchByCusName(self):
        plate = f"川B{random.randint(10000,99999)}"
        goods="雪莲果"
        ic = self.ic
        customerName= eFBL.get_icCheck(host=self.jmsfHost,ic=ic).json()["data"]["aInfo"]["customerName"]
        print(customerName)
        cre_res = zcA.create_jmsf(host=self.gatewayHost,plate=plate,keyword=goods)
        print(cre_res.json())
        number = cre_res.json()["data"]["number"]
        aa = eFBL.do_freezeOrder(host=self.jmsfHost,attrValue=number)
        res = hpApi.get_listBackSkinTrucks(host=self.gatewayHost,customerName=customerName)
        print(res.json())
        assert res.json()["code"]=="200","车号查询失败"
        assert res.json()["data"][-1]["number"]==number,"车号查询失败"