Add fix for ipa plugins command

Fix adds count of plugins loaded to return dict

Fixes https://fedorahosted.org/freeipa/ticket/6513

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Reviewed-By: Martin Basti <mbasti@redhat.com>
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-01-12 18:38:37 +05:30 committed by Martin Basti
parent 66867319d9
commit b3c41f21e5
2 changed files with 5 additions and 1 deletions

View File

@ -124,8 +124,9 @@ class plugins(LocalOrRemote):
for plugin in self.api[namespace](): for plugin in self.api[namespace]():
cls = type(plugin) cls = type(plugin)
key = '{}.{}'.format(cls.__module__, cls.__name__) key = '{}.{}'.format(cls.__module__, cls.__name__)
result.setdefault(key, []).append(namespace) result.setdefault(key, []).append(namespace.decode('utf-8'))
return dict( return dict(
result=result, result=result,
count=len(result),
) )

View File

@ -51,6 +51,9 @@ class TestCLIParsing(object):
def test_ping(self): def test_ping(self):
self.check_command('ping', 'ping') self.check_command('ping', 'ping')
def test_plugins(self):
self.check_command('plugins', 'plugins')
def test_user_show(self): def test_user_show(self):
self.check_command('user-show admin', 'user_show', uid=u'admin') self.check_command('user-show admin', 'user_show', uid=u'admin')