diff options
author | Ondrej Hamada <ohamada@redhat.com> | 2012-05-04 10:25:42 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-05-07 08:35:11 +0200 |
commit | 343aba2486e4b2a406e6f023c2a0a2c24841796f (patch) | |
tree | 36da32dade75268889075120160338c5b557d5a3 /tests | |
parent | 85185a89dbd62fdb0295f404e60152a68c790ef8 (diff) | |
download | freeipa-343aba2486e4b2a406e6f023c2a0a2c24841796f.tar.gz freeipa-343aba2486e4b2a406e6f023c2a0a2c24841796f.tar.xz freeipa-343aba2486e4b2a406e6f023c2a0a2c24841796f.zip |
Allow one letter net/hostgroups names
Changed regex validating net/hostgroup names to allow single letter
names. Unit-tests added.
https://fedorahosted.org/freeipa/ticket/2671
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_xmlrpc/test_hostgroup_plugin.py | 37 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_netgroup_plugin.py | 32 |
2 files changed, 69 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_hostgroup_plugin.py b/tests/test_xmlrpc/test_hostgroup_plugin.py index eda5f02f8..5642b1097 100644 --- a/tests/test_xmlrpc/test_hostgroup_plugin.py +++ b/tests/test_xmlrpc/test_hostgroup_plugin.py @@ -32,6 +32,10 @@ hostgroup1 = u'testhostgroup1' dn1 = DN(('cn',hostgroup1),('cn','hostgroups'),('cn','accounts'), api.env.basedn) +hostgroup_single = u'a' +dn_single = DN(('cn',hostgroup_single),('cn','hostgroups'),('cn','accounts'), + api.env.basedn) + fqdn1 = u'testhost1.%s' % api.env.domain host_dn1 = DN(('fqdn',fqdn1),('cn','computers'),('cn','accounts'), api.env.basedn) @@ -267,6 +271,39 @@ class test_hostgroup(Declarative): dict( + desc='Create hostgroup with name containing only one letter: %r' % hostgroup_single, + command=('hostgroup_add', [hostgroup_single], + dict(description=u'Test hostgroup with single letter in name') + ), + expected=dict( + value=hostgroup_single, + summary=u'Added hostgroup "a"', + result=dict( + dn=lambda x: DN(x) == dn_single, + cn=[hostgroup_single], + objectclass=objectclasses.hostgroup, + description=[u'Test hostgroup with single letter in name'], + ipauniqueid=[fuzzy_uuid], + mepmanagedentry=lambda x: [DN(i) for i in x] == \ + [DN(('cn',hostgroup_single),('cn','ng'),('cn','alt'), + api.env.basedn)], + ), + ), + ), + + + dict( + desc='Delete %r' % hostgroup_single, + command=('hostgroup_del', [hostgroup_single], {}), + expected=dict( + value=hostgroup_single, + summary=u'Deleted hostgroup "a"', + result=dict(failed=u''), + ), + ), + + + dict( desc='Delete host %r' % fqdn1, command=('host_del', [fqdn1], {}), expected=dict( diff --git a/tests/test_xmlrpc/test_netgroup_plugin.py b/tests/test_xmlrpc/test_netgroup_plugin.py index 40ad1ea67..03d5b9fa3 100644 --- a/tests/test_xmlrpc/test_netgroup_plugin.py +++ b/tests/test_xmlrpc/test_netgroup_plugin.py @@ -38,6 +38,7 @@ ccache = krbV.default_context().default_ccache().name netgroup1 = u'netgroup1' netgroup2 = u'netgroup2' +netgroup_single = u'a' host1 = u'ipatesthost.%s' % api.env.domain host_dn1 = DN(('fqdn',host1),('cn','computers'),('cn','accounts'), @@ -173,6 +174,37 @@ class test_netgroup(Declarative): dict( + desc='Create netgroup with name containing only one letter: %r' % netgroup_single, + command=('netgroup_add', [netgroup_single], + dict(description=u'Test netgroup_single') + ), + expected=dict( + value=netgroup_single, + summary=u'Added netgroup "%s"' % netgroup_single, + result=dict( + dn=fuzzy_netgroupdn, + cn=[netgroup_single], + objectclass=objectclasses.netgroup, + description=[u'Test netgroup_single'], + nisdomainname=['%s' % api.env.domain], + ipauniqueid=[fuzzy_uuid], + ), + ), + ), + + + dict( + desc='Delete %r' % netgroup_single, + command=('netgroup_del', [netgroup_single], {}), + expected=dict( + value=netgroup_single, + summary=u'Deleted netgroup "%s"' % netgroup_single, + result=dict(failed=u''), + ), + ), + + + dict( desc='Try to create duplicate %r' % netgroup1, command=('netgroup_add', [netgroup1], dict(description=u'Test netgroup 1') |