增加缓存使用方式

This commit is contained in:
wangjie 2023-09-27 22:02:48 +08:00
parent b966cc51d3
commit e0a8629ea1
2 changed files with 2 additions and 1 deletions

1
run.py
View File

@ -57,6 +57,7 @@ if __name__ == '__main__':
'-p', 'no:sugar', # 禁用pytest-sugar美化控制台结果
# '-k not test_login.py', # 不执行该文件里的case
# '-m smoke', # 只运行mark标记为smoke的测试用例
'-W', 'ignore:Module already imported so cannot be rewritten'
])
# ------------------------------发送allure报告----------------------------------

View File

@ -16,7 +16,7 @@ from utils.cache_handle import CacheHandler
def get_token():
"""获取登录V1的token"""
logger.info("开始用例前置操作")
# 调登录接口获取登录接口的token¬
# 调登录接口获取登录接口的token
login_response = Login().login('18800000001', '123456')
token = BaseApi.get_json(login_response)['data']['token']
CacheHandler.set_cache('Authorization', f'Bearer {token}')