summaryrefslogtreecommitdiffstats
path: root/ipatests/test_xmlrpc
diff options
context:
space:
mode:
authorLenka Doudova <ldoudova@redhat.com>2016-07-15 17:57:53 +0200
committerMartin Babinsky <mbabinsk@redhat.com>2016-07-20 18:08:34 +0200
commit9093647f867e49bffc9042185b1765b48fe7400a (patch)
treec333875f07b501918139c0461c0923acac82655e /ipatests/test_xmlrpc
parenta0d90263d62f48f0c04b8b9e7da3aaa10201c3a0 (diff)
downloadfreeipa-9093647f867e49bffc9042185b1765b48fe7400a.tar.gz
freeipa-9093647f867e49bffc9042185b1765b48fe7400a.tar.xz
freeipa-9093647f867e49bffc9042185b1765b48fe7400a.zip
Tests: Improve handling of rename operation by user tracker
Improving handling of rename operation by user tracker, together with fixes for user tests, that failed as consequence. Failures were caused by RFE Kerberos principal alias. Some tests were rewritten, since they used "--setattr" option instead of "--rename", and hence didn't reflect proper behaviour of the principal aliases feature. https://fedorahosted.org/freeipa/ticket/6024 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipatests/test_xmlrpc')
-rw-r--r--ipatests/test_xmlrpc/test_user_plugin.py31
-rw-r--r--ipatests/test_xmlrpc/tracker/user_plugin.py9
2 files changed, 15 insertions, 25 deletions
diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py
index def522814..7c27abc56 100644
--- a/ipatests/test_xmlrpc/test_user_plugin.py
+++ b/ipatests/test_xmlrpc/test_user_plugin.py
@@ -316,24 +316,10 @@ class TestUpdate(XMLRPC_test):
renameduser.ensure_missing()
olduid = user.uid
- # using user.update(dict(uid=value)) results in
- # OverlapError: overlapping arguments and options: ['uid']
- user.attrs.update(uid=[renameduser.uid])
- command = user.make_update_command(
- updates=dict(setattr=(u'uid=%s' % renameduser.uid))
- )
- result = command()
- user.check_update(result)
- user.uid = renameduser.uid
+ user.update(updates=dict(rename=renameduser.uid))
# rename the test user back so it gets properly deleted
- user.attrs.update(uid=[olduid])
- command = user.make_update_command(
- updates=dict(setattr=(u'uid=%s' % olduid))
- )
- result = command()
- user.check_update(result)
- user.uid = olduid
+ user.update(updates=dict(rename=olduid))
def test_rename_to_the_same_value(self, user):
""" Try to rename user to the same value """
@@ -640,18 +626,13 @@ class TestUserWithGroup(XMLRPC_test):
if its manager is also renamed """
renamed_name = u'renamed_npg2'
old_name = user_npg2.uid
- command = user_npg2.make_update_command(dict(rename=renamed_name))
- result = command()
- user_npg2.attrs.update(uid=[renamed_name])
- user_npg2.check_update(result)
+
+ user_npg2.update(updates=dict(rename=renamed_name))
+
user_npg.attrs.update(manager=[renamed_name])
user_npg.retrieve(all=True)
- command = user_npg2.make_command(
- 'user_mod', renamed_name, **dict(rename=old_name)
- )
- # we rename the user back otherwise the tracker is too confused
- result = command()
+ user_npg2.update(updates=dict(rename=old_name))
def test_check_if_manager_gets_removed(self, user_npg, user_npg2):
""" Delete manager and check if it's gone from user's attributes """
diff --git a/ipatests/test_xmlrpc/tracker/user_plugin.py b/ipatests/test_xmlrpc/tracker/user_plugin.py
index 1a85e9332..d95c3e223 100644
--- a/ipatests/test_xmlrpc/tracker/user_plugin.py
+++ b/ipatests/test_xmlrpc/tracker/user_plugin.py
@@ -196,6 +196,12 @@ class UserTracker(Tracker):
for key, value in updates.items():
if value is None or value is '' or value is u'':
del self.attrs[key]
+ elif key == 'rename':
+ new_principal = u'{0}@{1}'.format(value, self.api.env.realm)
+ self.attrs['uid'] = [value]
+ self.attrs['krbcanonicalname'] = [new_principal]
+ if new_principal not in self.attrs['krbprincipalname']:
+ self.attrs['krbprincipalname'].append(new_principal)
else:
if type(value) is list:
self.attrs[key] = value
@@ -212,6 +218,9 @@ class UserTracker(Tracker):
extra_keys=set(updates.keys()) | set(expected_updates.keys())
)
+ if 'rename' in updates:
+ self.uid = self.attrs['uid'][0]
+
def check_create(self, result, extra_keys=()):
""" Check 'user-add' command result """
expected = self.filter_attrs(self.create_keys | set(extra_keys))