TA的每日心情 | 无聊 昨天 09:47 |
---|
签到天数: 528 天 连续签到: 1 天 [LV.9]测试副司令
|
1测试积点
python+request+pytest对同一个地址发起options、post请求,cookie保存在post响应头Authorization中,如何获取?
-
- @pytest.mark.parametrize('url,headers', [('https://***', headers)])
- def test_login(self, url, headers):
- url = url
- headers = headers
- res = requests.options(url=url, headers=headers)
- # print('\n**********\n',res.headers['Allow'])
- assert res.status_code == 204
- @pytest.mark.parametrize('url,data,headers', [
- ('https://***', {'mobile': '***',
- 'password': '1234567'},
- headers)
- ])
- def test_getseesion(self, url, data, headers):
- url = url
- data = data
- headers = headers
- res = requests.post(url=url, data=data, headers=headers)
- hd = res.headers
- print('\n***********\n', hd, '\n***********\n')
- assert res.status_code == 200
- def test_logout(self):
- token = ''
- print(token)
复制代码 结果打印的hd中不包含Authorization,我们的session是保存在cookie里的,如何获取?
|
|