test_fc_edit.py 2.11 KB
import unittest
import urllib3
from commons.MySession import my,sy1
from commons.api.fc_edit import fc_edit
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
from commons.Faker import random_data
from commons.api.fc_add import fc_add
ra = random_data()
fca = fc_add()
import commons.ConfigDB as db

fc=fc_edit()
class test_fc_edit(unittest.TestCase):
    "返还人管理——修改返还人"
    @classmethod
    def setUpClass(cls):
        pass
    def setUp(self):
        body = fc.body.replace("18828281176", ra.phone_number()). \
            replace("你好", ra.name()). \
            replace("888810054630", "888810054630")

        # body = fca.body.replace("888810054630", "888810054630"). \
        #     replace("你好", ra.name()). \
        #     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'))
        self.mesg = db.mysql_selectOne('''SELECT id,name,mobile,card_number
FROM `dili_jmsf`.`feedback_customer`  WHERE market_id = '''+str(sy1.user["sy_user01"]["firmId"])+''' ORDER BY `id` DESC LIMIT 1''')
        # print(self.mesg)
    def test_fc_edit_01(self):
        "id=40&name=农交&mobile=18828281176&cardNumber=888810054630&\
            relationCardTemp=210720133001&relationalCard[0].cardNumber=210720131533"

        body = fc.body.replace("id=40","id="+str(self.mesg[0])).\
            replace("农交",str(self.mesg[1])).\
            replace("18828281176",str(self.mesg[2])).\
            replace("888810054630",str(self.mesg[3])).\
            replace("relationalCard[0].cardNumber=210720131533","relationalCard[0].cardNumber=210720125142")
        # 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()