Ejemplo n.º 1
0
def test_save_flows_content(ctx, tmpdir):
    flows = [tflow.tflow(resp=False), tflow.tflow(resp=True)]
    with mock.patch('time.time', mock.Mock(side_effect=[1, 2, 2] * 4)):
        static_viewer.save_flows_content(tmpdir, flows)
    flows_path = tmpdir.join('flows')
    assert len(flows_path.listdir()) == len(flows)
    for p in flows_path.listdir():
        assert p.join('request').check(dir=1)
        assert p.join('response').check(dir=1)
        assert p.join('request/content.data').check(file=1)
        assert p.join('request/content').check(dir=1)
        assert p.join('response/content.data').check(file=1)
        assert p.join('response/content').check(dir=1)
        assert p.join('request/content/Auto.json').check(file=1)
        assert p.join('response/content/Auto.json').check(file=1)
Ejemplo n.º 2
0
def test_save_flows_content(ctx, tmpdir):
    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)
    flows_path = tmpdir.join('flows')
    assert len(flows_path.listdir()) == len(flows)
    for p in flows_path.listdir():
        assert p.join('request').check(dir=1)
        assert p.join('response').check(dir=1)
        assert p.join('request/content.data').check(file=1)
        assert p.join('request/content').check(dir=1)
        assert p.join('response/content.data').check(file=1)
        assert p.join('response/content').check(dir=1)
        assert p.join('request/content/Auto.json').check(file=1)
        assert p.join('response/content/Auto.json').check(file=1)