MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_roundtrip

Method test_roundtrip

test/mitmproxy/test_flow.py:35–54  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

33
34class TestSerialize:
35 def test_roundtrip(self):
36 sio = io.BytesIO()
37 f = tflow.tflow()
38 f.marked = ":default:"
39 f.marked = True
40 f.comment = "test comment"
41 f.request.content = bytes(range(256))
42 w = mitmproxy.io.FlowWriter(sio)
43 w.add(f)
44
45 sio.seek(0)
46 r = mitmproxy.io.FlowReader(sio)
47 lst = list(r.stream())
48 assert len(lst) == 1
49
50 f2 = lst[0]
51 assert f2.get_state() == f.get_state()
52 assert f2.request.data == f.request.data
53 assert f2.marked
54 assert f2.comment == "test comment"
55
56 def test_filter(self):
57 sio = io.BytesIO()

Callers

nothing calls this directly

Calls 3

addMethod · 0.95
streamMethod · 0.95
get_stateMethod · 0.45

Tested by

no test coverage detected