test_fc_add.py 1.11 KB
import unittest
import urllib3
from commons.MySession import sy1
from commons.api.fc_add import fc_add
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
from commons.Faker import random_data
fc=fc_add()
ra = random_data()

class test_fc_add(unittest.TestCase):
    "返还人管理——新增返还人"
    @classmethod
    def setUpClass(cls):
        pass
    # def setUp(self):
    #

    def test_fc_add_01(self):
        body = fc.body.replace("18828281176",ra.phone_number()).\
            replace("你好",ra.name()).\
            replace("888810054630","888810054630")
            # 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()