test_fc_view.py 1.3 KB
import unittest
import urllib3
import commons.ConfigDB as db
from commons.MySession import my,sy1
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):
        pass

    def setUp(self):
        # 获取数据:从MYSQL获取新增返还人的id号
        self.code = db.mysql_selectOne('''SELECT * FROM `dili_jmsf`.`feedback_customer` WHERE 
        market_id =  '''+str(sy1.user["sy_user01"]["firmId"])+''' ORDER BY `id` DESC LIMIT 1''')[0]


    # @unittest.case_mark(my.mark())
    def test_fc_view_01(self):

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


    @classmethod
    def tearDownClass(cls):
        pass

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