summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-01-06 15:12:41 +0100
committerMartin Kosek <mkosek@redhat.com>2012-01-12 09:43:05 +0100
commit52ea3a6b2958875da6370433d14509bdbd4c4943 (patch)
treec523383fdba7b9c0bfa72376ece4bdca2b962e0b /tests
parent91c10419f8a32d070ac4b8fa0378ea48bb82388e (diff)
downloadfreeipa-52ea3a6b2958875da6370433d14509bdbd4c4943.tar.gz
freeipa-52ea3a6b2958875da6370433d14509bdbd4c4943.tar.xz
freeipa-52ea3a6b2958875da6370433d14509bdbd4c4943.zip
Refactor dnsrecord processing
Current DNS record processing architecture has many flaws, including custom execute() methods which does not take advantage of base LDAP commands or nonstandard and confusing DNS record option processing. This patch refactors DNS record processing with the following improvements: * Every DNS record has now own Parameter type. Each DNS record consists from one or more "parts" which are also Parameters. This architecture will enable much easier implementation of future per-DNS-type API. * Validation is now not written as a separate function for every parameter but is delegated to DNS record parts. * Normalization is also delegated to DNS record parts. * Since standard LDAP base commands execute method is now used, dnsrecord-add and dnsrecord-mod correctly supports --setattr and --addattr options. * In order to prevent confusion unsupported DNS record types are now hidden. They are still present in the plugin so that old clients receive proper validation error. The patch also contains several fixes: * Fix domain-name validation and normalization- allow domain names that are not fully qualified. For example --cname-rec=bar is a valid domain-name for bind which will translate it then as bar.<owning-domain>. This change implies, that fully qualified domain names must end with '.'. * Do not let user accidentally remove entire zone with command "ipa dnsrecord-del @ --del-all". * Fix --ttl and --class option processing in dnsrecord-add and dnsrecord-mod. All API changes are compatible with clients without this patch. https://fedorahosted.org/freeipa/ticket/2082
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_dns_plugin.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/test_xmlrpc/test_dns_plugin.py b/tests/test_xmlrpc/test_dns_plugin.py
index 1d800f82a..00d4f9b7d 100644
--- a/tests/test_xmlrpc/test_dns_plugin.py
+++ b/tests/test_xmlrpc/test_dns_plugin.py
@@ -414,6 +414,13 @@ class test_dns(Declarative):
dict(
+ desc='Try to delete root zone record \'@\' in %r' % (dnszone1),
+ command=('dnsrecord_del', [dnszone1, u'@'], {'del_all' : True}),
+ expected=errors.ValidationError(name='del_all', error=''),
+ ),
+
+
+ dict(
desc='Create record %r in zone %r' % (dnszone1, dnsres1),
command=('dnsrecord_add', [dnszone1, dnsres1], {'arecord': u'127.0.0.1'}),
expected={
@@ -575,13 +582,13 @@ class test_dns(Declarative):
dict(
desc='Try to add invalid LOC record to zone %r using dnsrecord_add' % (dnszone1),
- command=('dnsrecord_add', [dnszone1, u'@'], {'locrecord': u"91 11 42.4 N 16 36 29.6 E 227.64m" }),
+ command=('dnsrecord_add', [dnszone1, u'@'], {'locrecord': u"91 11 42.4 N 16 36 29.6 E 227.64" }),
expected=errors.ValidationError(name='locrecord', error=''),
),
dict(
desc='Add LOC record to zone %r using dnsrecord_add' % (dnszone1),
- command=('dnsrecord_add', [dnszone1, u'@'], {'locrecord': u"49 11 42.4 N 16 36 29.6 E 227.64m" }),
+ command=('dnsrecord_add', [dnszone1, u'@'], {'locrecord': u"49 11 42.4 N 16 36 29.6 E 227.64" }),
expected={
'value': u'@',
'summary': None,
@@ -591,7 +598,7 @@ class test_dns(Declarative):
'idnsname': [dnszone1],
'mxrecord': [u"0 %s" % dnszone1_mname],
'nsrecord': [dnszone1_mname],
- 'locrecord': [u"49 11 42.4 N 16 36 29.6 E 227.64m"],
+ 'locrecord': [u"49 11 42.4 N 16 36 29.6 E 227.64"],
},
},
),
@@ -604,7 +611,7 @@ class test_dns(Declarative):
dict(
desc='Add CNAME record to %r using dnsrecord_add' % (dnsres1),
- command=('dnsrecord_add', [dnszone1, dnsres1], {'cnamerecord': u'foo-1.example.com' }),
+ command=('dnsrecord_add', [dnszone1, dnsres1], {'cnamerecord': u'foo-1.example.com.' }),
expected={
'value': dnsres1,
'summary': None,
@@ -626,7 +633,7 @@ class test_dns(Declarative):
dict(
desc='Add KX record to %r using dnsrecord_add' % (dnsres1),
- command=('dnsrecord_add', [dnszone1, dnsres1], {'kxrecord': u'1 foo-1.example.com' }),
+ command=('dnsrecord_add', [dnszone1, dnsres1], {'kxrecord': u'1 foo-1' }),
expected={
'value': dnsres1,
'summary': None,
@@ -636,7 +643,7 @@ class test_dns(Declarative):
'idnsname': [dnsres1],
'arecord': [u'10.10.0.1'],
'cnamerecord': [u'foo-1.example.com.'],
- 'kxrecord': [u'1 foo-1.example.com'],
+ 'kxrecord': [u'1 foo-1'],
},
},
),