MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_simple

Function test_simple

test/mitmproxy/addons/test_view.py:100–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98
99
100def test_simple():
101 v = view.View()
102 f = tft(start=1)
103 assert v.store_count() == 0
104 v.requestheaders(f)
105 assert list(v) == [f]
106 assert v.get_by_id(f.id)
107 assert not v.get_by_id("nonexistent")
108
109 # These all just call update
110 v.error(f)
111 v.response(f)
112 v.intercept(f)
113 v.resume(f)
114 v.kill(f)
115 assert list(v) == [f]
116
117 v.requestheaders(f)
118 assert list(v) == [f]
119 assert len(v._store) == 1
120 assert v.store_count() == 1
121
122 f2 = tft(start=3)
123 v.requestheaders(f2)
124 assert list(v) == [f, f2]
125 v.requestheaders(f2)
126 assert list(v) == [f, f2]
127 assert len(v._store) == 2
128
129 assert v.inbounds(0)
130 assert not v.inbounds(-1)
131 assert not v.inbounds(100)
132
133 f3 = tft(start=2)
134 v.requestheaders(f3)
135 assert list(v) == [f, f3, f2]
136 v.requestheaders(f3)
137 assert list(v) == [f, f3, f2]
138 assert len(v._store) == 3
139
140 f.marked = not f.marked
141 f2.marked = not f2.marked
142 v.clear_not_marked()
143 assert list(v) == [f, f2]
144 assert len(v) == 2
145 assert len(v._store) == 2
146
147 v.clear()
148 assert len(v) == 0
149 assert len(v._store) == 0
150
151
152def test_simple_tcp():

Callers

nothing calls this directly

Calls 12

store_countMethod · 0.95
requestheadersMethod · 0.95
get_by_idMethod · 0.95
errorMethod · 0.95
responseMethod · 0.95
interceptMethod · 0.95
resumeMethod · 0.95
killMethod · 0.95
inboundsMethod · 0.95
clear_not_markedMethod · 0.95
clearMethod · 0.95
tftFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…