fc_view.py 1.56 KB
import unittest
import urllib3
import commons.ConfigDB as db
from commons import common as com
from commons.MySession import my
from commons.api.fc_view import fc_view
from commons.api.fc_add import fc_add
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ad = fc_add()
vi = fc_view()

class test_fc_view(unittest.TestCase):
    "查看返还人"

    @classmethod
    def setUpClass(cls):
        # 通过字段配置接口提前配置新增页的字段配置
        my.post(url = ad.url, headers = ad.header, data = ad.body.encode('utf-8'))

    def setUp(self):
        # 准备数据
        my.post(url=ad.url, headers=ad.header, data=ad.body.encode('utf-8'))
        # 获取数据:从MYSQL获取新增返还人的id号
        self.code = db.mysql_selectOne("SELECT * FROM `dili_jmsf`.`feedback_customer` ORDER BY `id` DESC LIMIT 1")[0]
        print("查询出返还人id", self.code)

    # @unittest.case_mark(my.mark())
    def test_doAudit_01(self):
        "查看返还人"
        # 请求url中的需要替换为新增返还人的id
        url = vi.url.replace("40", str(self.code))
        print("数据处理后的url", url)
        # 进行GET请求
        re = my.get(url=url, headers=vi.header)
        # 打印请求结果(可删除该代码,一般只在调试时使用)
        print(re.text)
        # 断言响应数据中是否存在期望字符串
        self.assertTrue('关联交费卡号' in str(re.text))

        return re

    @classmethod
    def tearDownClass(cls):
        pass

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