From 81199ae3e60eb46470a6c56584f951b50032c2ea Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 5 Dec 2019 00:57:20 +0100 Subject: [PATCH] summary: Improve on the dummy test --- summary/test_summary.py | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/summary/test_summary.py b/summary/test_summary.py index 7f94f56..32ae775 100644 --- a/summary/test_summary.py +++ b/summary/test_summary.py @@ -1,8 +1,45 @@ from pyln.testing.fixtures import * +import subprocess + pluginopt = {'plugin': os.path.join(os.path.dirname(__file__), "summary.py")} def test_summary_start(node_factory): l1 = node_factory.get_node(options=pluginopt) - l1.rpc.getinfo() + s = l1.rpc.summary() + from pprint import pprint;pprint(s) + + expected = { + 'format-hint': 'simple', + 'network': 'REGTEST', + 'num_channels': 0, + 'num_connected': 0, + 'num_gossipers': 0, + 'num_utxos': 0, + 'warning_no_address': 'NO PUBLIC ADDRESSES' + } + + for k, v in expected.items(): + assert(s[k] == v) + + +def test_summary_opts(directory): + opts = ['--summary-currency', '--summary-currency-prefix'] + + help_out = subprocess.check_output([ + 'lightningd', + '--lightning-dir={}'.format(directory), + '--help' + ]).decode('utf-8') + for o in opts: + assert(o not in help_out) + + help_out = subprocess.check_output([ + 'lightningd', + '--lightning-dir={}'.format(directory), + '--plugin={}'.format(pluginopt['plugin']), + '--help' + ]).decode('utf-8') + for o in opts: + assert(o in help_out)