summaryrefslogtreecommitdiffstats
path: root/tests/test_xmlrpc
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:15 +0200
commit070bc7f725dc33e61bf421b9973292721ae6fbfa (patch)
treeca887167f6d7074c6bd19bf35af7777cc3eef168 /tests/test_xmlrpc
parent2916ad4ac2ba8bee3cd66e6c6f30e3cdcb913b06 (diff)
downloadfreeipa-070bc7f725dc33e61bf421b9973292721ae6fbfa.tar.gz
freeipa-070bc7f725dc33e61bf421b9973292721ae6fbfa.tar.xz
freeipa-070bc7f725dc33e61bf421b9973292721ae6fbfa.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/test_xmlrpc')
-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={