This commit is contained in:
Tomas Kopecek 2019-05-21 15:20:25 +02:00 committed by Mike McLean
parent adb9d9049a
commit afdc04be5d
2 changed files with 12 additions and 8 deletions

View file

@ -2739,7 +2739,7 @@ def anon_handle_list_channels(goptions, session, args):
usage = _("usage: %prog list-channels")
usage += _("\n(Specify the --help global option for a list of other help options)")
parser = OptionParser(usage=usage)
parser.add_option("--simple", action="store_true", default=goptions.quiet,
parser.add_option("--simple", action="store_true", default=False,
help=_("Print just list of channels without additional info"))
parser.add_option("--quiet", action="store_true", default=goptions.quiet,
help=_("Do not print header information"))

View file

@ -27,20 +27,24 @@ class TestListChannels(unittest.TestCase):
]
self.session.multiCall.return_value = [
[[
{'enabled': True, 'ready': True},
{'enabled': True, 'ready': False},
{'enabled': True, 'ready': False},
{'enabled': True, 'ready': True, 'capacity': 2.0, 'task_load': 1.34},
{'enabled': True, 'ready': False, 'capacity': 2.0, 'task_load': 0.0},
{'enabled': True, 'ready': False, 'capacity': 2.0, 'task_load': 0.0},
]],
[[
{'enabled': True, 'ready': True},
{'enabled': False, 'ready': True},
{'enabled': True, 'ready': False},
{'enabled': True, 'ready': True, 'capacity': 2.0, 'task_load': 1.34},
{'enabled': False, 'ready': True, 'capacity': 2.0, 'task_load': 0.34},
{'enabled': True, 'ready': False, 'capacity': 2.0, 'task_load': 0.0},
]],
]
anon_handle_list_channels(self.options, self.session, self.args)
actual = stdout.getvalue()
expected = 'default 3 1 0\ntest 2 2 1\n'
print(actual)
expected = """\
default 3 1 0 1/ 6/ 22%
test 2 2 1 1/ 6/ 28%
"""
self.assertMultiLineEqual(actual, expected)
activate_session_mock.assert_called_once_with(self.session, self.options)