def setUp(self): # 登录 获取token token_info = login_1(self.session) self.token = token_info['token_type'] + ' ' + token_info['token'] self.headers['Authorization'] = self.token log.info(f'{self.headers}')
def setUp(self): # 初始化session self.session = HttpSessionHandler() # 登录账号,获取token_info token_info = login_1(self.session) token = token_info['token_type'] + ' ' + token_info['token'] # 完善请求头 self.headers['Authorization'] = token log.info(self.headers)
def setUpClass(cls): cls.session = HttpSessionHandler() cls.url = config.get('api', 'base_url') + config.get('api', 'loans_url') cls.headers = eval(config.get('api', 'headers')) cls.headers.pop('Content-Type') token_info = login_1(cls.session) cls.headers['Authorization'] = token_info['token_type'] + ' ' + token_info['token'] log.info(f'{cls.url}')
def setUp(self): token_info = login_1(session=self.session) token = token_info['token_type'] + ' ' + token_info['token'] self.headers['Authorization'] = token
def setUp(self): self.session = HttpSessionHandler() # 登录并放回token_info token_info = login_1(self.session) self.headers['Authorization'] = token_info['token_type'] + " " + token_info['token']
def setUp(self): # 登录 获取token token_info = login_1(self.session) token = token_info['token_type'] + " " + token_info['token'] self.headers['Authorization'] = token