fc_add.py 1.06 KB
import unittest
import urllib3
from commons import common as com
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
fc=fc_add()
ra = random_data()

class test_fc_add(unittest.TestCase):
    "新增返还人"
    @classmethod
    def setUpClass(cls):
        my.post(url=fc.url, headers=fc.header, data=fc.body.encode('utf-8'))

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

    @classmethod
    def tearDownClass(cls):
        pass


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