def test_error(self): sio = StringIO() sio.write("bogus") sio.seek(0) r = flow.FlowReader(sio) tutils.raises(FlowReadException, list, r.stream()) f = FlowReadException("foo") assert str(f) == "foo"
def test_error(self): sio = io.BytesIO() sio.write(b"bogus") sio.seek(0) r = mitmproxy.io.FlowReader(sio) tutils.raises(FlowReadException, list, r.stream()) f = FlowReadException("foo") assert str(f) == "foo"
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"