| 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( |