summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-10-11 10:54:34 +0200
committerMartin Kosek <mkosek@redhat.com>2011-10-11 15:15:29 +0200
commitdc39e953498e9b7a1cbd0574279b76ab2c84dfb4 (patch)
tree13bea92dc3282c8573afbe58330258a27c651259 /tests
parentc23b3819e1c2d9c58b97617ef7516a3177b38bbf (diff)
downloadfreeipa-dc39e953498e9b7a1cbd0574279b76ab2c84dfb4.tar.gz
freeipa-dc39e953498e9b7a1cbd0574279b76ab2c84dfb4.tar.xz
freeipa-dc39e953498e9b7a1cbd0574279b76ab2c84dfb4.zip
Fix dnszone-add name_from_ip server validation
Ticket 1627 contained a (temporary hack-ish) fix for dnszone-add name_from_ip validation which works fine for CLI. However, when the command is not proceeded via CLI and sent directly to the RPC server, the server throws Internal Server Error. Make sure that the server returns a reasonable error. Also implement 2 unit cases testing this option https://fedorahosted.org/freeipa/ticket/1941
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_dns_plugin.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_dns_plugin.py b/tests/test_xmlrpc/test_dns_plugin.py
index f9bce61d9..679f285d5 100644
--- a/tests/test_xmlrpc/test_dns_plugin.py
+++ b/tests/test_xmlrpc/test_dns_plugin.py
@@ -29,6 +29,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.'
+revdnszone1_ip = u'80.142.15.0/24'
dnsres1 = u'testdnsres'
class test_dns(Declarative):
@@ -551,6 +552,53 @@ class test_dns(Declarative):
dict(
+ desc='Try to create a reverse zone from invalid IP',
+ command=(
+ 'dnszone_add', [], {
+ 'name_from_ip': u'foo',
+ 'idnssoamname': u'ns1.%s' % dnszone1,
+ 'idnssoarname': u'root.%s' % dnszone1,
+ 'ip_address' : u'1.2.3.4',
+ }
+ ),
+ expected=errors.ValidationError(name='name_from_ip', error='invalid format'),
+ ),
+
+
+ dict(
+ desc='Create reverse from IP %s zone using name_from_ip option' % revdnszone1_ip,
+ command=(
+ 'dnszone_add', [], {
+ 'name_from_ip': revdnszone1_ip,
+ 'idnssoamname': u'ns1.%s' % dnszone1,
+ 'idnssoarname': u'root.%s' % dnszone1,
+ 'ip_address' : u'1.2.3.4',
+ }
+ ),
+ expected={
+ 'value': revdnszone1,
+ 'summary': None,
+ 'result': {
+ 'dn': lambda x: DN(x) == \
+ DN(('idnsname',revdnszone1),('cn','dns'),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='Delete zone %r' % dnszone1,
command=('dnszone_del', [dnszone1], {}),
expected={