| 184 | ) |
| 185 | |
| 186 | def test_responses(self): |
| 187 | req = tutils.tdnsreq() |
| 188 | resp = tutils.tdnsresp() |
| 189 | resp2 = req.succeed( |
| 190 | [ |
| 191 | dns.ResourceRecord.A( |
| 192 | "dns.google", ipaddress.IPv4Address("8.8.8.8"), ttl=32 |
| 193 | ), |
| 194 | dns.ResourceRecord.A( |
| 195 | "dns.google", ipaddress.IPv4Address("8.8.4.4"), ttl=32 |
| 196 | ), |
| 197 | ] |
| 198 | ) |
| 199 | resp2.timestamp = resp.timestamp |
| 200 | assert resp == resp2 |
| 201 | assert resp2.size == 8 |
| 202 | with pytest.raises(ValueError): |
| 203 | req.fail(dns.response_codes.NOERROR) |
| 204 | assert ( |
| 205 | req.fail(dns.response_codes.FORMERR).response_code |
| 206 | == dns.response_codes.FORMERR |
| 207 | ) |
| 208 | |
| 209 | def test_range(self): |
| 210 | def test(what: str, min: int, max: int): |