summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipalib/plugins/dns.py2
-rw-r--r--tests/test_xmlrpc/test_dns_plugin.py82
2 files changed, 83 insertions, 1 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index 23abdd94d..d50a9f6e8 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -45,7 +45,7 @@ EXAMPLES:
ipa dnsrecord-add example.com www --a-rec 80.142.15.2
Add new PTR record for www.example.com
- ipa dnsrecord-add 15.142.80.in-addr.arpa 2 --ptr-rec www.example.com.
+ ipa dnsrecord-add 15.142.80.in-addr.arpa. 2 --ptr-rec www.example.com.
Add new SRV records for LDAP servers. Three quarters of the requests
should go to fast.example.com, one quarter to slow.example.com. If neither
diff --git a/tests/test_xmlrpc/test_dns_plugin.py b/tests/test_xmlrpc/test_dns_plugin.py
index 4a149db2e..efff3866f 100644
--- a/tests/test_xmlrpc/test_dns_plugin.py
+++ b/tests/test_xmlrpc/test_dns_plugin.py
@@ -27,6 +27,7 @@ from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
dnszone1 = u'dnszone.test'
dnszone2 = u'dnszone2.test'
+revdnszone1 = u'15.142.80.in-addr.arpa.'
dnsres1 = u'testdnsres'
class test_dns(Declarative):
@@ -48,6 +49,8 @@ class test_dns(Declarative):
cleanup_commands = [
('dnszone_del', [dnszone1], {}),
('dnsrecord_del', [dnszone1, dnsres1], {'del_all' : True}),
+ ('dnszone_del', [dnszone2], {}),
+ ('dnszone_del', [revdnszone1], {}),
]
tests = [
@@ -214,10 +217,78 @@ class test_dns(Declarative):
dict(
+ desc='Create reverse zone %r' % revdnszone1,
+ command=(
+ 'dnszone_add', [revdnszone1], {
+ 'idnssoamname': u'ns1.%s' % dnszone1,
+ 'idnssoarname': u'root.%s' % dnszone1,
+ 'ip_address' : u'1.2.3.4',
+ }
+ ),
+ expected={
+ 'value': revdnszone1,
+ 'summary': None,
+ 'result': {
+ 'dn': u'idnsname=%s,cn=dns,%s' % (revdnszone1, api.env.basedn),
+ 'idnsname': [revdnszone1],
+ 'idnszoneactive': [u'TRUE'],
+ 'idnssoamname': [u'ns1.%s.' % dnszone1],
+ 'nsrecord': [u'ns1.%s.' % dnszone1],
+ 'idnssoarname': [u'root.%s.' % dnszone1],
+ 'idnssoaserial': [fuzzy_digits],
+ 'idnssoarefresh': [fuzzy_digits],
+ 'idnssoaretry': [fuzzy_digits],
+ 'idnssoaexpire': [fuzzy_digits],
+ 'idnssoaminimum': [fuzzy_digits],
+ 'idnsallowdynupdate': [u'FALSE'],
+ 'objectclass': [u'top', u'idnsrecord', u'idnszone'],
+ },
+ },
+ ),
+
+
+ dict(
desc='Search for zones with name server %r' % (u'ns1.%s.' % dnszone1),
command=('dnszone_find', [], {'idnssoamname': u'ns1.%s.' % dnszone1}),
expected={
'summary': None,
+ 'count': 2,
+ 'truncated': False,
+ 'result': [{
+ 'dn': u'idnsname=%s,cn=dns,%s' % (revdnszone1, api.env.basedn),
+ 'idnsname': [revdnszone1],
+ 'idnszoneactive': [u'TRUE'],
+ 'nsrecord': [u'ns1.%s.' % dnszone1],
+ 'idnssoamname': [u'ns1.%s.' % dnszone1],
+ 'idnssoarname': [u'root.%s.' % dnszone1],
+ 'idnssoaserial': [fuzzy_digits],
+ 'idnssoarefresh': [fuzzy_digits],
+ 'idnssoaretry': [fuzzy_digits],
+ 'idnssoaexpire': [fuzzy_digits],
+ 'idnssoaminimum': [fuzzy_digits],
+ },
+ {
+ 'dn': u'idnsname=%s,cn=dns,%s' % (dnszone1, api.env.basedn),
+ 'idnsname': [dnszone1],
+ 'idnszoneactive': [u'TRUE'],
+ 'nsrecord': [u'ns1.%s.' % dnszone1],
+ 'idnssoamname': [u'ns1.%s.' % dnszone1],
+ 'idnssoarname': [u'root.%s.' % dnszone1],
+ 'idnssoaserial': [fuzzy_digits],
+ 'idnssoarefresh': [u'5478'],
+ 'idnssoaretry': [fuzzy_digits],
+ 'idnssoaexpire': [fuzzy_digits],
+ 'idnssoaminimum': [fuzzy_digits],
+ }],
+ },
+ ),
+
+
+ dict(
+ desc='Search for zones with name server %r with --forward-only' % (u'ns1.%s.' % dnszone1),
+ command=('dnszone_find', [], {'idnssoamname': u'ns1.%s.' % dnszone1, 'forward_only' : True}),
+ expected={
+ 'summary': None,
'count': 1,
'truncated': False,
'result': [{
@@ -238,6 +309,17 @@ class test_dns(Declarative):
dict(
+ desc='Delete reverse zone %r' % revdnszone1,
+ command=('dnszone_del', [revdnszone1], {}),
+ expected={
+ 'value': revdnszone1,
+ 'summary': None,
+ 'result': {'failed': u''},
+ },
+ ),
+
+
+ dict(
desc='Disable zone %r' % dnszone1,
command=('dnszone_disable', [dnszone1], {}),
expected={