MCPcopy Create free account
hub / github.com/rthalley/dnspython / test_svcb_wire

Method test_svcb_wire

tests/test_svcb.py:256–284  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

254 self.check_valid_inputs(valid_inputs_two_keys)
255
256 def test_svcb_wire(self):
257 valid_inputs = (
258 '1 . mandatory="alpn,port" alpn="h2" port="257"',
259 "\\# 24 0001 00 0000000400010003 00010003026832 000300020101",
260 )
261 self.check_valid_inputs(valid_inputs)
262
263 everything = (
264 '100 foo.com. mandatory="alpn,port" alpn="h2,h3" '
265 ' no-default-alpn port="12345" ech="abcd" '
266 " ipv4hint=1.2.3.4,4.3.2.1 ipv6hint=1::2,3::4"
267 ' key12345="foo"'
268 )
269 rr = dns.rdata.from_text("IN", "SVCB", everything)
270 rr2 = dns.rdata.from_text("IN", "SVCB", rr.to_generic().to_text())
271 self.assertEqual(rr, rr2)
272
273 invalid_inputs = (
274 # As above, but the keys are out of order.
275 "\\# 24 0001 00 0000000400010003 000300020101 00010003026832",
276 # As above, but the mandatory keys don't match
277 "\\# 24 0001 00 0000000400010002 00010003026832 000300020101",
278 "\\# 24 0001 00 0000000400010004 00010003026832 000300020101",
279 # Alias form shouldn't have parameters.
280 "\\# 08 0000 000300020101",
281 # no-default-alpn requires alpn
282 "\\# 07 0001 00 00020000",
283 )
284 self.check_invalid_inputs(invalid_inputs)
285
286 def test_misc_escape(self):
287 rdata = dns.rdata.from_text("in", "svcb", "1 . alpn=\\010\\010")

Callers

nothing calls this directly

Calls 5

check_valid_inputsMethod · 0.95
check_invalid_inputsMethod · 0.95
from_textMethod · 0.45
to_textMethod · 0.45
to_genericMethod · 0.45

Tested by

no test coverage detected