From c76247a14817151e1285a0efcf41c7b852c40357 Mon Sep 17 00:00:00 2001 From: Robin Norwood Date: Wed, 24 Jan 2018 18:32:28 -0600 Subject: [PATCH] Use str() instead of to_string(), as to_string() sometimes returns bytes --- pyethapp/app.py | 2 +- pyethapp/tests/test_app.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pyethapp/app.py b/pyethapp/app.py index 65af45ae..18535d40 100644 --- a/pyethapp/app.py +++ b/pyethapp/app.py @@ -583,7 +583,7 @@ def list_accounts(ctx): id='Id (if any)', locked='Locked')) for i, account in enumerate(accounts): - click.echo(fmt.format(i='#' + to_string(i + 1), + click.echo(fmt.format(i='#' + str(i + 1), address=encode_hex(account.address or ''), id=account.uuid or '', locked='yes' if account.locked else 'no')) diff --git a/pyethapp/tests/test_app.py b/pyethapp/tests/test_app.py index e28db7b7..99cd20d0 100644 --- a/pyethapp/tests/test_app.py +++ b/pyethapp/tests/test_app.py @@ -43,6 +43,13 @@ def test_no_such_command(): result = runner.invoke(app.app, ['eat']) assert 'Error: No such command "eat"' in result.output, result.output +def test_account_list(): + runner = CliRunner() + result = runner.invoke(app.app, ['account', 'list']) + assert '#1' in result.output, result.output + assert 'Locked' in result.output, result.output + + print(result.output) @pytest.mark.parametrize('content', ['', '', 'print "hello world"']) def test_non_dict_yaml_as_config_file(content): @@ -117,3 +124,4 @@ def test_config_from_datadir(tmpdir): test_custom_config_file(('-C', 'myconfig.yaml')) test_custom_config_file(('-c', 'mygenesis.json')) test_custom_config_file(('-c', 'dict')) + test_account_list()