From 70a57924c8e265df1e97b7f0be1adf8da802fbfd Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 18 Oct 2010 14:53:32 -0400 Subject: Allow RDN changes for users, groups, rolegroups and taskgroups. To do a change right now you have to perform a setattr like: ipa user-mod --setattr uid=newuser olduser The RDN change is performed before the rest of the mods. If the RDN change is the only change done then the EmptyModlist that update_entry() throws is ignored. ticket 323 --- tests/test_xmlrpc/test_user_plugin.py | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'tests/test_xmlrpc/test_user_plugin.py') diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py index ee02a0f81..8c2bae499 100644 --- a/tests/test_xmlrpc/test_user_plugin.py +++ b/tests/test_xmlrpc/test_user_plugin.py @@ -31,6 +31,7 @@ from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid user_memberof = (u'cn=ipausers,cn=groups,cn=accounts,%s' % api.env.basedn,) user1=u'tuser1' user2=u'tuser2' +renameduser1=u'tuser' invaliduser1=u'+tuser1' invaliduser2=u'tuser1234567890123456789012345678901234567890' @@ -65,6 +66,13 @@ class test_user(Declarative): ), + dict( + desc='Try to rename non-existent %r' % user1, + command=('user_mod', [user1], dict(setattr=u'uid=tuser')), + expected=errors.NotFound(reason='no such entry'), + ), + + dict( desc='Create %r' % user1, command=( @@ -300,6 +308,49 @@ class test_user(Declarative): ), + dict( + desc='Rename %r' % user1, + command=('user_mod', [user1], dict(setattr=u'uid=%s' % renameduser1)), + expected=dict( + result=dict( + givenname=[u'Finkle'], + homedirectory=[u'/home/tuser1'], + loginshell=[u'/bin/sh'], + sn=[u'User1'], + uid=[renameduser1], + memberof_group=[u'ipausers'], + ), + summary=u'Modified user "%s"' % user1, + value=user1, + ), + ), + + + dict( + desc='Rename %r to same value' % renameduser1, + command=('user_mod', [renameduser1], dict(setattr=u'uid=%s' % renameduser1)), + expected=errors.EmptyModlist(), + ), + + + dict( + desc='Rename back %r' % renameduser1, + command=('user_mod', [renameduser1], dict(setattr=u'uid=%s' % user1)), + expected=dict( + result=dict( + givenname=[u'Finkle'], + homedirectory=[u'/home/tuser1'], + loginshell=[u'/bin/sh'], + sn=[u'User1'], + uid=[user1], + memberof_group=[u'ipausers'], + ), + summary=u'Modified user "%s"' % renameduser1, + value=renameduser1, + ), + ), + + dict( desc='Delete %r' % user1, command=('user_del', [user1], {}), -- cgit