import pytest
import requests
class TestSendRequest:
#全局变量/类变量:通过类名访问
page=""
def test_get(self):
url="https://server.taofen8.com/ocean/redPacket/history?"
data={
"userId":"2004412057079",
"pageNo":"1",
"status":"2"
}
rep = requests.get(url=url,params=data)
#返回字典格式的数据
print(rep.json())
TestSendRequest.page = rep.json()['pageNo']
def test_print(self):
print(TestSendRequest.page)
if __name__=='__main__':
pytest.main(['-vs'])
文件上传