diff options
author | Thomas Roten <tsr@lavabit.com> | 2017-06-26 10:10:41 -0500 |
---|---|---|
committer | Thomas Roten <tsr@lavabit.com> | 2017-06-26 10:10:41 -0500 |
commit | 7ef74ae3bd1aa979fde1a8aab2b99d7ff52d3b55 (patch) | |
tree | e766156c533c56cc9bfc7dbf2d4fe49c6ddc32b9 /tests/test_main.py | |
parent | b7c1ba89f0913de1b90c26002087a45ae0017d6d (diff) |
Move format_output out of Pgcli class.
Diffstat (limited to 'tests/test_main.py')
-rw-r--r-- | tests/test_main.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/test_main.py b/tests/test_main.py index 77ae1365..0380c6fa 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -9,7 +9,7 @@ except ImportError: setproctitle = None from pgcli.main import ( - obfuscate_process_password, PGCli, OutputSettings + obfuscate_process_password, format_output, PGCli, OutputSettings ) from utils import dbtest, run @@ -49,24 +49,22 @@ def test_obfuscate_process_password(): def test_format_output(): - pgcli = PGCli() settings = OutputSettings(table_format='psql', dcmlfmt='d', floatfmt='g') - results = pgcli.format_output('Title', [('abc', 'def')], ['head1', 'head2'], - 'test status', settings) + results = format_output('Title', [('abc', 'def')], ['head1', 'head2'], + 'test status', settings) expected = ['Title', '+---------+---------+\n| head1 | head2 |\n|---------+---------|\n| abc | def |\n+---------+---------+', 'test status'] assert results == expected def test_format_output_auto_expand(): - pgcli = PGCli() settings = OutputSettings( table_format='psql', dcmlfmt='d', floatfmt='g', max_width=100) - table_results = pgcli.format_output('Title', [('abc', 'def')], - ['head1', 'head2'], 'test status', settings) + table_results = format_output('Title', [('abc', 'def')], + ['head1', 'head2'], 'test status', settings) table = ['Title', '+---------+---------+\n| head1 | head2 |\n|---------+---------|\n| abc | def |\n+---------+---------+', 'test status'] assert table_results == table - expanded_results = pgcli.format_output('Title', [('abc', 'def')], - ['head1', 'head2'], 'test status', settings._replace(max_width=1)) + expanded_results = format_output('Title', [('abc', 'def')], + ['head1', 'head2'], 'test status', settings._replace(max_width=1)) expanded = [ 'Title', u'-[ RECORD 1 ]-------------------------\nhead1 | abc\nhead2 | def\n', 'test status'] assert expanded_results == expanded |