URL: https://github.com/freeipa/freeipa/pull/900 Author: Tiboris Title: #900: whoami.py: type error when running test Action: opened
PR body: """ While writing xmlrpc test for this plugin I bumped into: TypeError: whoami.validate_output(): output['arguments']: need (<type 'list'>,); got <type 'tuple'>: (u'krb_staged_user',) After change in [whoami.py](https://github.com/freeipa/freeipa/blob/master/ipaserver/plugins/whoami.py#L90) : ``` python output.Output('arguments', list, _('Arguments to details function')), ``` to: ``` python output.Output('arguments', tuple, _('Arguments to details function')), ``` invoking command whoami fails with output **InternalError: an internal error has occurred** @stlaz suggested changes which are in this PR. With these changes _whoami.validate_output()_ does not throw error and tests continue where they should. """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/900/head:pr900 git checkout pr900
From 43de262166b85814f8df18e59e05b23b47087857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdud...@redhat.com> Date: Wed, 28 Jun 2017 17:07:57 +0200 Subject: [PATCH] whoami.py: type error --- ipaserver/plugins/whoami.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ipaserver/plugins/whoami.py b/ipaserver/plugins/whoami.py index 0ec6bb8a7a..521c655b3d 100644 --- a/ipaserver/plugins/whoami.py +++ b/ipaserver/plugins/whoami.py @@ -87,7 +87,8 @@ class whoami(Command): has_output = ( output.Output('object', unicode, _('Object class name')), output.Output('command', unicode, _('Function to get details')), - output.Output('arguments', list, _('Arguments to details function')), + output.Output('arguments', + unicode, _('Arguments to details function')), ) def execute(self, **options): @@ -125,12 +126,12 @@ def execute(self, **options): if dn.find(container + api.env.basedn) == 1: # We found exact container this DN belongs to o_name = unicode(o.name) - o_args = [unicode(entry.single_value.get(o.primary_key.name))] + o_args = (unicode(entry.single_value.get(o.primary_key.name))) o_func = unicode(o.methods.show.full_name) if o.name in exceptions: - o_args = [unicode(exceptions[o.name][1]), + o_args = (unicode(exceptions[o.name][1]), unicode(entry.single_value.get( - exceptions[o.name][2]))] + exceptions[o.name][2]))) break return {'object': o_name, 'command': o_func, 'arguments': o_args}
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org