def test_download_cp_html_report(client, monkeypatch):
fgz = BytesIO()
with gzip.GzipFile('report.gz', mode='wb', fileobj=fgz) as gzipobj:
gzipobj.write(b'<html><head></head></html>')
monkeypatch.setattr(VxAPIClient, 'get', lambda *args, **kw: bytes(fgz))
monkeypatch.setattr(BaseQuery, 'first_or_404', lambda x: True)
rv = client.get(
url_for('cp.get_cp_vxstream_download',
sha256='sss', eid=1, ftype='html')
)
assert rv.status_code == 200
评论列表
文章目录