def test_error(self): sio = io.BytesIO() sio.write(b"bogus") sio.seek(0) r = mitmproxy.io.FlowReader(sio) with pytest.raises(FlowReadException, match='Invalid data format'): list(r.stream()) sio = io.BytesIO() f = tflow.tdummyflow() w = mitmproxy.io.FlowWriter(sio) w.add(f) sio.seek(0) r = mitmproxy.io.FlowReader(sio) with pytest.raises(FlowReadException, match='Unknown flow type'): list(r.stream()) f = FlowReadException("foo") assert str(f) == "foo"
def err(self): return tflow.tdummyflow(err=True)
def flow(self): return tflow.tdummyflow()
def err(self): return tflow.tdummyflow(err=True)
def flow(self): return tflow.tdummyflow()