MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_to_json

Method test_to_json

test/mitmproxy/test_dns.py:121–130  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

119 assert m.content == m.packed
120
121 def test_to_json(self):
122 resp = tutils.tdnsresp()
123 json = resp.to_json()
124 assert json["id"] == resp.id
125 assert len(json["questions"]) == len(resp.questions)
126 assert json["questions"][0]["name"] == resp.questions[0].name
127 assert len(json["answers"]) == len(resp.answers)
128 assert json["answers"][0]["data"] == str(resp.answers[0])
129
130 assert DNSMessage.from_json(resp.to_json()) == resp
131
132 def test_from_json(self):
133 assert DNSMessage.from_json(

Callers

nothing calls this directly

Calls 2

to_jsonMethod · 0.45
from_jsonMethod · 0.45

Tested by

no test coverage detected