# coding=gbk import unittest from libs.ddt import ddt, data from decimal import Decimal from handler.ConfigHandler import config from handler.ExcelHandler_one import load_sheet from handler.LogHandler import log from handler.RequestsHandler import HttpSessionHandler from helper.helper import is_register_1, login_1, get_leave_amount """读取测试数据""" sheet = config.get('excel', 'recharge_sheet') ex = load_sheet(sheet) test_data = ex.read() """获取用户信息""" mobile_phone = config.get('user', 'mobile_phone') password = config.get('user', 'password') # 判断用户是否存在,若不存在,则创建,并回写配置文件 user_id, 若存在,也回写 user_id is_register_1() # 获取 user id member_id = eval(config.get('user', 'member_id')) @ddt class TestRecharge(unittest.TestCase): @classmethod
# coding=gbk import unittest from decimal import Decimal from libs.ddt import ddt, data from handler.ConfigHandler import config from handler.ExcelHandler_one import load_sheet from handler.RequestsHandler import HttpSessionHandler from handler.LogHandler import log from helper.helper import is_register_1, login_1, get_invest_info, get_leave_amount, change_amount from helper.re_demo import deal """获取测试数据""" ex = load_sheet('invest_repl') test_case = ex.read() is_register_1() # 获取member_id member_id = eval(config.get('user', 'member_id')) @ddt class TestInvest(unittest.TestCase): @classmethod def setUpClass(cls): cls.session = HttpSessionHandler() cls.url = config.get('api', 'base_url') + config.get('api', 'invest_url') cls.headers = eval(config.get('api', 'headers')) log.info(f'url:{cls.url}')