MCPcopy
hub / github.com/mitmproxy/mitmproxy / test

Method test

test/mitmproxy/test_dns.py:210–221  ·  view source on GitHub ↗
(what: str, min: int, max: int)

Source from the content-addressed store, hash-verified

208
209 def test_range(self):
210 def test(what: str, min: int, max: int):
211 req = tutils.tdnsreq()
212 setattr(req, what, min)
213 assert getattr(dns.DNSMessage.unpack(req.packed), what) == min
214 setattr(req, what, min - 1)
215 with pytest.raises(ValueError):
216 req.packed
217 setattr(req, what, max)
218 assert getattr(dns.DNSMessage.unpack(req.packed), what) == max
219 setattr(req, what, max + 1)
220 with pytest.raises(ValueError):
221 req.packed
222
223 test("id", 0, 2**16 - 1)
224 test("reserved", 0, 7)

Callers 15

get_first_headerMethod · 0.80
match_headerMethod · 0.80
jiFunction · 0.80
index-Be7e-cwP.jsFile · 0.80
qaFunction · 0.80
KFunction · 0.80
elFunction · 0.80
nlFunction · 0.80
jnFunction · 0.80
ynFunction · 0.80
bnFunction · 0.80
CnFunction · 0.80

Calls 1

unpackMethod · 0.80

Tested by

no test coverage detected