diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-11-12 00:46:04 -0700 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-11-12 00:46:04 -0700 |
commit | 014af24731ff39520a9635694ed99dc9d09669c9 (patch) | |
tree | 3e861a7ba9f8ba9d07033fad6827920dfbc46c49 /tests/test_ipalib/test_cli.py | |
parent | f3869d7b24f65ca04494ff756e092d7aedd67a5c (diff) | |
download | freeipa-014af24731ff39520a9635694ed99dc9d09669c9.tar.gz freeipa-014af24731ff39520a9635694ed99dc9d09669c9.tar.xz freeipa-014af24731ff39520a9635694ed99dc9d09669c9.zip |
Changed calling signature of output_for_cli(); started work on 'textui' backend plugin
Diffstat (limited to 'tests/test_ipalib/test_cli.py')
-rw-r--r-- | tests/test_ipalib/test_cli.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_ipalib/test_cli.py b/tests/test_ipalib/test_cli.py index 565459421..8cedd0881 100644 --- a/tests/test_ipalib/test_cli.py +++ b/tests/test_ipalib/test_cli.py @@ -25,6 +25,31 @@ from tests.util import raises, get_api, ClassChecker from ipalib import cli, plugable, frontend, backend +class test_textui(ClassChecker): + _cls = cli.textui + + def test_max_col_width(self): + """ + Test the `ipalib.cli.textui.max_col_width` method. + """ + o = self.cls() + e = raises(TypeError, o.max_col_width, 'hello') + assert str(e) == 'rows: need %r or %r; got %r' % (list, tuple, 'hello') + rows = [ + 'hello', + 'naughty', + 'nurse', + ] + assert o.max_col_width(rows) == len('naughty') + rows = ( + ( 'a', 'bbb', 'ccccc'), + ('aa', 'bbbb', 'cccccc'), + ) + assert o.max_col_width(rows, col=0) == 2 + assert o.max_col_width(rows, col=1) == 4 + assert o.max_col_width(rows, col=2) == 6 + + def test_to_cli(): """ Test the `ipalib.cli.to_cli` function. |