Re: [Freeipa-devel] [PATCH] 093 Add new dnszone-find test

2011-07-15 Thread Rob Crittenden

Martin Kosek wrote:

Implement a test for new dnszone-find option --forward-only.
Fix example for reverse zone (zone was not fully qualified and
DNS plugin would forbid adding PTR records).

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


This looks ok, just one minor thing: can you add deleting the new 
reverse dnszone to the cleanup command? ACK with that.


thanks

rob

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 093 Add new dnszone-find test

2011-07-14 Thread Martin Kosek
Implement a test for new dnszone-find option --forward-only.
Fix example for reverse zone (zone was not fully qualified and
DNS plugin would forbid adding PTR records).

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

From 00e4c005b08b58f88ffa8f59724b644179e5bf15 Mon Sep 17 00:00:00 2001
From: Martin Kosek mko...@redhat.com
Date: Thu, 14 Jul 2011 11:14:14 +0200
Subject: [PATCH] Add new dnszone-find test

Implement a test for new dnszone-find option --forward-only.
Fix example for reverse zone (zone was not fully qualified and
DNS plugin would forbid adding PTR records).

https://fedorahosted.org/freeipa/ticket/1473
---
 ipalib/plugins/dns.py|2 +-
 tests/test_xmlrpc/test_dns_plugin.py |   80 ++
 2 files changed, 81 insertions(+), 1 deletions(-)

diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index e7a0a05a3c5b989fc7125492530c1deccae27f0c..426a3289834af6da54f26465b3bd161c05451d64 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -41,7 +41,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 4a149db2efbb61194a34d038ac5ddbeb140b53f2..ce5908d5367f5e3fb133c0a621be19a7a2b1406a 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):
@@ -214,10 +215,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],
+}],
+},
+),
+
+
+