summaryrefslogtreecommitdiffstats
path: root/tests/test_xmlrpc/test_role_plugin.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-02-29 13:31:20 -0500
committerRob Crittenden <rcritten@redhat.com>2012-02-29 18:00:58 -0500
commit83ab80c040166ad31555476c3dbc5cf435004906 (patch)
treeee71e261d449fda8562a233df2c7c46947718d1a /tests/test_xmlrpc/test_role_plugin.py
parent85967116322f4cde95fba6c39a277f19513a6185 (diff)
downloadfreeipa.git-83ab80c040166ad31555476c3dbc5cf435004906.tar.gz
freeipa.git-83ab80c040166ad31555476c3dbc5cf435004906.tar.xz
freeipa.git-83ab80c040166ad31555476c3dbc5cf435004906.zip
Only apply validation rules when adding and updating.
There may be cases, for whatever reason, that an otherwise illegal entry gets created that doesn't match the criteria for a valid user/host/group name. If this happens (i.e. migration) there is no way to remove this using the IPA tools because we always applied the name pattern. So you can't, for example, delete a user with an illegal name. Primary keys are cloned with query=True in PKQuery which causes no rules to be applied on mod/show/find. This reverts a change from commit 3a5e26a0 which applies class rules when query=True (for enforcing no white space). Replace rdnattr with rdn_is_primary_key. This was meant to tell us when an RDN change was necessary to do a rename. There could be a disconnect where the rdnattr wasn't the primary key and in that case we don't need to do an RDN change, so use a boolean instead so that it is clear that RDN == primary key. Add a test to ensure that nowhitespace is actually enforced. https://fedorahosted.org/freeipa/ticket/2115 Related: https://fedorahosted.org/freeipa/ticket/2089 Whitespace tickets: https://fedorahosted.org/freeipa/ticket/1285 https://fedorahosted.org/freeipa/ticket/1286 https://fedorahosted.org/freeipa/ticket/1287
Diffstat (limited to 'tests/test_xmlrpc/test_role_plugin.py')
-rw-r--r--tests/test_xmlrpc/test_role_plugin.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_role_plugin.py b/tests/test_xmlrpc/test_role_plugin.py
index 9c405cff..f871e268 100644
--- a/tests/test_xmlrpc/test_role_plugin.py
+++ b/tests/test_xmlrpc/test_role_plugin.py
@@ -33,6 +33,7 @@ role1 = u'test-role-1'
role1_dn = DN(('cn',role1),api.env.container_rolegroup,
api.env.basedn)
renamedrole1 = u'test-role'
+invalidrole1 = u' whitespace '
role2 = u'test-role-2'
role2_dn = DN(('cn',role2),api.env.container_rolegroup,
@@ -101,6 +102,15 @@ class test_role(Declarative):
dict(
+ desc='Create invalid %r' % invalidrole1,
+ command=('role_add', [invalidrole1],
+ dict(description=u'role desc 1')
+ ),
+ expected=errors.ValidationError(name='cn', error='Leading and trailing spaces are not allowed'),
+ ),
+
+
+ dict(
desc='Create %r' % role1,
command=('role_add', [role1],
dict(description=u'role desc 1')