From 7d7322de2eb0de61ea917d03662452d3efa4c834 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 24 Feb 2012 14:39:56 -0500 Subject: 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 --- tests/test_xmlrpc/test_hostgroup_plugin.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/test_xmlrpc/test_hostgroup_plugin.py') diff --git a/tests/test_xmlrpc/test_hostgroup_plugin.py b/tests/test_xmlrpc/test_hostgroup_plugin.py index e0d11585..f5c2efb7 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): @@ -69,6 +71,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], -- cgit