接口关联解决方案1

2021-09-01  本文已影响0人  PeppaTang

获取登录后的tokens使用

## CaseDemo

import unittest
from api_key_demo import ApiKeys

class CaseDemo(unittest.TestCase):
@classmethod
def setUpClass(cls) ->None:
cls.token = None
cls.api_key = ApiKeys()

def test_01_login(self):

    url = "https://www.douban.com/"
    data ={
        'username': '',
        'password': ''

    }
    res = self.api_key.do_post(url, json=data)
    CaseDemo = res.json()['token']

def test_02_login(self):
    header ={
        'token':self.token
    }
    res1 = self.api_key.do_get("https://www.douban.com/", headers=header)
    print(res1.text)
上一篇 下一篇

猜你喜欢

热点阅读