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

Method test_copy

test/mitmproxy/test_udp.py:9–41  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7
8class TestUDPFlow:
9 def test_copy(self):
10 f = tflow.tudpflow()
11 f.get_state()
12 f2 = f.copy()
13 a = f.get_state()
14 b = f2.get_state()
15 del a["id"]
16 del b["id"]
17 assert a == b
18 assert not f == f2
19 assert f is not f2
20
21 assert f.messages is not f2.messages
22
23 for m in f.messages:
24 assert m.get_state()
25 m2 = m.copy()
26 assert not m == m2
27 assert m is not m2
28
29 a = m.get_state()
30 b = m2.get_state()
31 assert a == b
32
33 m = udp.UDPMessage(False, "foo")
34 m.set_state(f.messages[0].get_state())
35 assert m.timestamp == f.messages[0].timestamp
36
37 f = tflow.tudpflow(err=True)
38 f2 = f.copy()
39 assert f is not f2
40 assert f.error.get_state() == f2.error.get_state()
41 assert f.error is not f2.error
42
43 def test_match(self):
44 f = tflow.tudpflow()

Callers

nothing calls this directly

Calls 4

get_stateMethod · 0.95
set_stateMethod · 0.95
get_stateMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected