Use shared sanity check and tests ipapython.dnsutil.is_auto_empty_zone()

https://fedorahosted.org/freeipa/ticket/5710

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Petr Spacek
2016-03-07 14:10:34 +01:00
committed by Petr Vobornik
parent 6752d6404a
commit 1df30b4646

View File

@@ -188,6 +188,18 @@ def assert_absolute_dnsname(name):
def is_auto_empty_zone(zone): def is_auto_empty_zone(zone):
"""True if specified zone name exactly matches an automatic empty zone.""" """True if specified zone name exactly matches an automatic empty zone.
assert isinstance(zone, DNSName)
>>> is_auto_empty_zone(DNSName('in-addr.arpa.'))
False
>>> is_auto_empty_zone(DNSName('10.in-addr.arpa.'))
True
>>> is_auto_empty_zone(DNSName('1.10.in-addr.arpa.'))
False
>>> is_auto_empty_zone(DNSName('10.in-addr.arpa'))
Traceback (most recent call last):
...
AssertionError: ...
"""
assert_absolute_dnsname(zone)
return zone in EMPTY_ZONES return zone in EMPTY_ZONES