test_feedback_order_settlement.py 2 KB
import unittest
import urllib3
from commons.MySession import my,sy1
from commons.api.feedback_order_settlement import feedback_order_settlement
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
from commons.api.feedback_order_settlement_query import feedback_order_settlement_query
import random
fosq = feedback_order_settlement_query()

fos = feedback_order_settlement()

class test_feedback_order_settlement(unittest.TestCase):
    "结账管理——结账"
    @classmethod
    def setUpClass(cls):
        pass

    def setUp(self):
        body = fosq.body.replace("feedbackCustomerId=25", "feedbackCustomerId=16").replace("2021-07-22 00:00:00", "\
            2021-07-03 00:00:00").replace("2021-08-03 23:59:59","2021-08-03 23:59:59")
        re = sy1.post(url=fosq.url, data=body, headers=fosq.header)
        # self.id = re.json()["rows"][0]["id"]
        self.Amount = re.json()["rows"][0]["unsettledAmount"]
        self.ids = re.json()["rows"][0]["id"]
        self.billIds = re.json()["rows"][0]["billId"]
        #
        # elf.name = re.json()["rows"][0]["name"]


    def test_feedback_order_settlement_01(self):
        body = fos.body.replace("id=25","id=25").replace("888810057654","888810057654")\
            .replace("settleAmount=2","settleAmount="+str(self.Amount)).\
            replace("ids=12034","ids="+str(self.ids)).\
            replace("feedbackCustomerId=25","feedbackCustomerId=25").\
            replace("feedbackCustomerName=验证员工推送到CRM","feedbackCustomerName=验证员工推送到CRM").\
            replace("billIds=3621","billIds="+str(self.billIds)).\
            replace("settledAmounts=2","settledAmounts="+str(self.Amount))
        print(body)
        re = sy1.post(url = fos.url, headers = fos.header, data = body.encode('utf-8'))
        print(re.headers)

        print(re.json())
        self.assertTrue("操作成功" in str(re.json()))
        return re

    @classmethod
    def tearDownClass(cls):
        pass


if __name__ == '__main__':
    unittest.main()