test_feedback_order_settlement.py 2.89 KB
import unittest
import urllib3
from commons.MySession import 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
fosq = feedback_order_settlement_query()
import datetime
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", str(datetime.datetime.now()))
        re = sy1.post(url = fosq.url, data = body, headers = fosq.header)

        self.Amount = re.json()["rows"][0]["unsettledAmount"]
        self.ids = re.json()["rows"][0]["id"]
        self.billIds = re.json()["rows"][0]["billId"]
        #查询出结账金额、结算单id和与之相关联的进门单id
        url = "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/settleAccount.action"
        header = {
             "X-Requested-With": "XMLHttpRequest",
             "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
             "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
        }
        body = "customerId=16"
        re2 = sy1.post(url = url,headers = header,data = body)
        self.idd = re2.json()["id"]
        self.name = re2.json()["name"]
        self.cardNumber = re2.json()["cardNumber"]
        #查询出结账单的id、name、cardnumber

    # def test_feedback_order_settlement_01(self):
    #     "选择需要返点的订单进行结账."
    #     body = fos.body.replace("id=25","id="+str(self.idd)).\
    #         replace("888810057654",str(self.cardNumber)).\
    #         replace("settleAmount=2","settleAmount="+str(self.Amount)).\
    #         replace("ids=12034","ids="+str(self.ids)).\
    #         replace("feedbackCustomerId=25","feedbackCustomerId="+str(self.idd)).\
    #         replace("feedbackCustomerName=验证员工推送到CRM","feedbackCustomerName="+str(self.name)).\
    #         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()