test_fc_add.py 1.59 KB
import unittest
import urllib3
from commons.MySession import my,sy1
from commons.api.fc_add import fc_add
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
from commons.Faker import random_data
import commons.ConfigDB as db
fc=fc_add()
ra = random_data()

"""
进门收费——返点管理——返还人管理——新增返还人
"""

class test_fc_add(unittest.TestCase):
    "返还人管理——新增返还人"
    @classmethod
    def setUpClass(cls):
        pass
    def setUp(self):
        self.cardnb = db.mysql_selectOne('''SELECT card_no FROM `dili_account`.`account_user_card` WHERE state = 1 
        AND firm_id = '''+str(sy1.user["sy_user01"]["firmId"])+''' ORDER BY id LIMIT 1''')[0]
    def test_fc_add_01(self):
        body = fc.body.replace("18828281176",ra.phone_number()).\
            replace("你好",ra.name()).\
            replace("888810054630",str(self.cardnb))
        # body = fc.body.replace("18828281176", ra.phone_number()). \
        #     replace("你好", ra.name()). \
        #     replace("888810054630", str(self.cardnb)). \
        #     replace("relationCardTemp=888810054630", "relationCardTemp=888810054630"). \
        #     replace("relationalCard[0].cardNumber=888810054630", "relationalCard[0].cardNumber=888810054630")
        # print(body)
        re = sy1.post(url=fc.url, headers=fc.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()