summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-02-24 14:39:56 -0500
committerRob Crittenden <rcritten@redhat.com>2012-02-27 00:06:44 -0500
commit7d7322de2eb0de61ea917d03662452d3efa4c834 (patch)
treeb553e8fa4180f59db38ea3b01fcbd73bba0f09b7 /tests
parenta09063cbb83aa9c3c77886fe43d70ba15fe4ef48 (diff)
downloadfreeipa-7d7322de2eb0de61ea917d03662452d3efa4c834.tar.gz
freeipa-7d7322de2eb0de61ea917d03662452d3efa4c834.tar.xz
freeipa-7d7322de2eb0de61ea917d03662452d3efa4c834.zip
Limit allowed characters in a netgroup name to alpha, digit, -, _ and .
Apply this to hostgroup names as well since they can be linked. https://fedorahosted.org/freeipa/ticket/2221
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_hostgroup_plugin.py9
-rw-r--r--tests/test_xmlrpc/test_netgroup_plugin.py9
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_hostgroup_plugin.py b/tests/test_xmlrpc/test_hostgroup_plugin.py
index e0d115854..f5c2efb79 100644
--- a/tests/test_xmlrpc/test_hostgroup_plugin.py
+++ b/tests/test_xmlrpc/test_hostgroup_plugin.py
@@ -36,6 +36,8 @@ fqdn1 = u'testhost1.%s' % api.env.domain
host_dn1 = DN(('fqdn',fqdn1),('cn','computers'),('cn','accounts'),
api.env.basedn)
+invalidhostgroup1 = u'@invalid'
+
class test_hostgroup(Declarative):
@@ -70,6 +72,13 @@ class test_hostgroup(Declarative):
dict(
+ desc='Test an invalid hostgroup name %r' % invalidhostgroup1,
+ command=('hostgroup_add', [invalidhostgroup1], dict(description=u'Test')),
+ expected=errors.ValidationError(name='cn', error='may only include letters, numbers, _, - and .'),
+ ),
+
+
+ dict(
desc='Create %r' % hostgroup1,
command=('hostgroup_add', [hostgroup1],
dict(description=u'Test hostgroup 1')
diff --git a/tests/test_xmlrpc/test_netgroup_plugin.py b/tests/test_xmlrpc/test_netgroup_plugin.py
index 9194b5492..1c6b94bd2 100644
--- a/tests/test_xmlrpc/test_netgroup_plugin.py
+++ b/tests/test_xmlrpc/test_netgroup_plugin.py
@@ -56,6 +56,8 @@ user2 = u'pexample'
group1 = u'testgroup'
+invalidnetgroup1=u'+badnetgroup'
+
class test_netgroup(Declarative):
"""
Test the `netgroup` plugin.
@@ -97,6 +99,13 @@ class test_netgroup(Declarative):
dict(
+ desc='Test an invalid netgroup name %r' % invalidnetgroup1,
+ command=('netgroup_add', [invalidnetgroup1], dict(description=u'Test')),
+ expected=errors.ValidationError(name='cn', error='may only include letters, numbers, _, - and .'),
+ ),
+
+
+ dict(
desc='Create %r' % netgroup1,
command=('netgroup_add', [netgroup1],
dict(description=u'Test netgroup 1')