summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorPetr Spacek <pspacek@redhat.com>2016-03-07 14:10:34 +0100
committerPetr Vobornik <pvoborni@redhat.com>2016-04-28 18:46:06 +0200
commit1df30b4646d0738c5d218acf9f65b6617a970c98 (patch)
treec9edad3af2d3bacdfaad7a7ad931a46e038aae95 /ipapython
parent6752d6404af13a933105e53ea5875adfb933e293 (diff)
downloadfreeipa-1df30b4646d0738c5d218acf9f65b6617a970c98.tar.gz
freeipa-1df30b4646d0738c5d218acf9f65b6617a970c98.tar.xz
freeipa-1df30b4646d0738c5d218acf9f65b6617a970c98.zip
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>
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/dnsutil.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/ipapython/dnsutil.py b/ipapython/dnsutil.py
index 6ff500b22..e8d2f6ff6 100644
--- a/ipapython/dnsutil.py
+++ b/ipapython/dnsutil.py
@@ -188,6 +188,18 @@ def assert_absolute_dnsname(name):
def is_auto_empty_zone(zone):
- """True if specified zone name exactly matches an automatic empty zone."""
- assert isinstance(zone, DNSName)
+ """True if specified zone name exactly matches an automatic empty zone.
+
+ >>> 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