mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
[web] Static_viewer coverage ++.
This commit is contained in:
parent
af30930ae8
commit
d008f179c3
@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from mitmproxy.test import taddons
|
from mitmproxy.test import taddons
|
||||||
from mitmproxy.test import tflow
|
from mitmproxy.test import tflow
|
||||||
@ -32,8 +33,10 @@ def test_save_flows(tmpdir):
|
|||||||
assert tmpdir.join('flows.json').read() == json.dumps([flow_to_json(f) for f in flows])
|
assert tmpdir.join('flows.json').read() == json.dumps([flow_to_json(f) for f in flows])
|
||||||
|
|
||||||
|
|
||||||
def test_save_flows_content(tmpdir):
|
@mock.patch('mitmproxy.ctx.log')
|
||||||
|
def test_save_flows_content(ctx, tmpdir):
|
||||||
flows = [tflow.tflow(req=True, resp=None), tflow.tflow(req=True, resp=True)]
|
flows = [tflow.tflow(req=True, resp=None), tflow.tflow(req=True, resp=True)]
|
||||||
|
with mock.patch('time.time', mock.Mock(side_effect=[1, 2, 2] * 4)):
|
||||||
static_viewer.save_flows_content(tmpdir, flows)
|
static_viewer.save_flows_content(tmpdir, flows)
|
||||||
flows_path = tmpdir.join('flows')
|
flows_path = tmpdir.join('flows')
|
||||||
assert len(flows_path.listdir()) == len(flows)
|
assert len(flows_path.listdir()) == len(flows)
|
||||||
|
Loading…
Reference in New Issue
Block a user