import pytest
-from digdelv.common import ARTIFACTS, check_ttl_range, needs_pyyaml, parse_yaml
+from digdelv.common import ARTIFACTS, check_ttl_range, parse_yaml
from isctest.util import param
import isctest
assert check_ttl_range(result.out, "SOA", 300)
-@needs_pyyaml
def test_coflag_yaml(dig, ns3):
"""Check that dig +coflag +yaml shows the CO flag in the sent query."""
result = dig(f"+yaml +tcp @{ns3.ip} +coflag +qr example")
assert "UPDATE-LEASE: 3600 (1 hour)" in result.out
-@needs_pyyaml
def test_ednsopt_update_lease_yaml(dig, ns3):
"""Check that a single-lease UPDATE-LEASE option prints as expected
with +yaml."""
assert "UPDATE-LEASE: 3600/1209600 (1 hour/2 weeks)" in result.out
-@needs_pyyaml
def test_ednsopt_update_lease_split_yaml(dig, ns3):
"""Check that a split-lease UPDATE-LEASE option prints as expected
with +yaml."""
assert Re(pattern) in result.out
-@needs_pyyaml
def test_ednsopt_llq_yaml(dig, ns3):
"""Check that the LLQ option prints as expected with +yaml."""
result = dig(
assert check_ttl_range(result.out, "A", 300)
-@needs_pyyaml
def test_ednsopt_key_tag_yaml(dig, ns3):
"""Check that a key-tag value list prints as a list with +yaml."""
result = dig(f"@{ns3.ip} +yaml +ednsopt=key-tag:00010002 a.example +qr")
assert "status: FORMERR" not in result.out
-@needs_pyyaml
@pytest.mark.parametrize("tag", ["client-tag", "server-tag"])
def test_ednsopt_tag_yaml(dig, ns3, tag):
"""Check that a client/server-tag value prints as expected with +yaml."""
assert r'; CHAIN: "\000\""' in result.out
-@needs_pyyaml
def test_ednsopt_chain_yaml(dig, ns3):
"""Check that the CHAIN option prints special characters escaped
with +yaml."""
assert "; EXPIRE: 1200 (20 minutes)" in result.out
-@needs_pyyaml
def test_expire_yaml(dig, ns1):
"""Check that dig processes +expire with +yaml."""
result = dig(f"@{ns1.ip} +yaml +expire . soa")
assert "; TCP-KEEPALIVE: 30.0 secs" in result.out
-@needs_pyyaml
def test_keepalive_yaml(dig, ns1):
"""Check that dig processes +keepalive with +yaml."""
result = dig(f"@{ns1.ip} +yaml +keepalive . soa +tcp")
assert Re("^" + re.escape(expected) + "$") in result.out
-@needs_pyyaml
@pytest.mark.parametrize(
"payload,info_code,extra_text",
[
assert ede["EXTRA-TEXT"] == extra_text
-@needs_pyyaml
def test_ednsopt_ede_yaml_specials(dig, ns3):
"""Check that EDE extra text with '"' and '\\' specials survives YAML
quoting."""
assert edns_yaml(result.out)["EDE"]["EXTRA-TEXT"] == 'foo"\\'
-@needs_pyyaml
@pytest.mark.parametrize(
"payload,expected",
[
assert "; ZONEVERSION:" not in result.out
-@needs_pyyaml
def test_zoneversion_yaml(dig, ns2):
"""Check +yaml +zoneversion against an authoritative server."""
result = dig(f"@{ns2.ip} +yaml +zoneversion a.example")
)
-@needs_pyyaml
def test_zoneversion_non_serial_yaml(dig, ns2):
"""Check the display of a non SOA-SERIAL type zoneversion with +yaml."""
result = dig(f"@{ns2.ip} +qr +ednsopt=ZONEVERSION:0100000007DA a.example +yaml")
assert check_ttl_range(result.out, "A", 300)
-@needs_pyyaml
@pytest.mark.parametrize("option,subnet", ZERO_SUBNETS)
def test_subnet_zero_yaml(dig, ns2, option, subnet):
"""Check that a zero-length client subnet is echoed in the +yaml
assert edns_yaml(result.out, "response")["CLIENT-SUBNET"] == subnet
-@needs_pyyaml
def test_subnet_yaml(dig, ns2):
"""Check that +subnet=dead::/16 is shown in the +yaml query."""
result = dig(f"+yaml +tcp @{ns2.ip} +qr +subnet=dead::/16 A a.example")
assert "no servers could be reached" in result.out
-@needs_pyyaml
def test_yaml_valid_when_no_server_reached(dig, ans7):
"""Check that dig +yaml produces valid YAML when no servers could be
reached; the ";"-prefixed startup banner must not precede the
assert result.rc >= 0
-@needs_pyyaml
def test_yaml_any_output(dig, ns3):
"""Check the structure of dig +yaml output for an ANY query."""
result = dig(f"+qr +yaml @{ns3.ip} any ns2.example")
assert response["QUESTION_SECTION"][0] == "ns2.example. IN ANY"
-@needs_pyyaml
def test_yaml_ipv6_trailing_zeroes(dig, ns3):
"""Check dig +yaml output of an IPv6 address ending in zeroes."""
result = dig(f"+qr +yaml @{ns3.ip} aaaa d.example")
assert answer == "d.example. 300 IN AAAA fd92:7065:b8e:ffff::0"
-@needs_pyyaml
@pytest.mark.parametrize(
"qname", ["yaml", "'.yaml", "[.yaml", "{.yaml", "&.yaml", "#.yaml"]
)
assert answer == f'{qname}.example. 300 IN TXT "a: b"'
-@needs_pyyaml
def test_yaml_character_values(dig, ns3):
"""Check the quoting of all 256 character values in dig +yaml TXT
output."""