test_batchSettlement.py 2.04 KB
# -*- coding: utf-8 -*-

# @Time    : 2021/9/10 11:01
# @Author  : Ljq
# @File    : test_batchSettlement.py
# @Software: PyCharm

"""
杭果市场-结算管理-批号管理
"""


from commons.api.hg.settlement import batch
from commons.api.hg.settlement import batchSettlement
from commons.api.hg.settlement import sellingGoods
from commons.MySession import sessionHg as session
from commons.api.hg.CheckIn import CheckIn
from commons.scripts.readConf import rC
import unittest,random

class test_batch(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", "hg_cardNumRe_01")
        cls.ic_buyer = rC.returnOptionsItems("testInfo", "hg_cardNumRe_02")
        cls.posCode = rC.returnOptionsItems("testInfo", "hg_posCode_01")

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

    def test_searchState_1(self):
        """
        批号管理--查询--验证查询已关闭的批号自动加载批号信息
        """
        # 创建初始数据
        posCode = self.posCode
        state = "2"
        resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
        batchCode = resBatchCode.json()["data"]["batchCode"]
        print("test_searchState_1 --> self.batchCode:", batchCode)
        # 变更交易状态
        resCAT = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=batchCode,state=state)
        print(resCAT.json())
        assert resCAT.json()["code"]=="200","登记单状态变更失败"
        # 结算单查询
        res = batchSettlement.settle_query(session=session,host=self.gatewayHost,batchCode=batchCode)
        print(res.text)
        assert "tradingOrder" in res.text,"验证查询已关闭的批号自动加载批号信息"