mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-23 16:14:20 +01:00
pytest: test summary exclude option
And some drive-by minor cleanups
This commit is contained in:
committed by
Christian Decker
parent
db4357a766
commit
eab10a051b
@@ -1,6 +1,8 @@
|
||||
from pyln.testing.fixtures import *
|
||||
import subprocess
|
||||
import unittest
|
||||
|
||||
from pyln.testing.fixtures import * # noqa: F401,F403
|
||||
from pyln.testing.utils import DEVELOPER
|
||||
|
||||
pluginopt = {'plugin': os.path.join(os.path.dirname(__file__), "summary.py")}
|
||||
|
||||
@@ -8,7 +10,6 @@ pluginopt = {'plugin': os.path.join(os.path.dirname(__file__), "summary.py")}
|
||||
def test_summary_start(node_factory):
|
||||
l1 = node_factory.get_node(options=pluginopt)
|
||||
s = l1.rpc.summary()
|
||||
from pprint import pprint;pprint(s)
|
||||
|
||||
expected = {
|
||||
'format-hint': 'simple',
|
||||
@@ -43,3 +44,35 @@ def test_summary_opts(directory):
|
||||
]).decode('utf-8')
|
||||
for o in opts:
|
||||
assert(o in help_out)
|
||||
|
||||
|
||||
@unittest.skipIf(not DEVELOPER, "We need fast gossip for line_graph")
|
||||
def test_summary_exclude(node_factory):
|
||||
l1, l2 = node_factory.line_graph(2, opts=pluginopt)
|
||||
|
||||
s = l1.rpc.summary()
|
||||
expected = {
|
||||
'format-hint': 'simple',
|
||||
'network': 'REGTEST',
|
||||
'num_channels': 1,
|
||||
'num_connected': 1,
|
||||
'num_gossipers': 0,
|
||||
'num_utxos': 1,
|
||||
'warning_no_address': 'NO PUBLIC ADDRESSES'
|
||||
}
|
||||
for k, v in expected.items():
|
||||
assert(s[k] == v)
|
||||
|
||||
scid = l1.rpc.listchannels()['channels'][0]['short_channel_id']
|
||||
s = l1.rpc.summary(exclude=scid)
|
||||
expected = {
|
||||
'format-hint': 'simple',
|
||||
'network': 'REGTEST',
|
||||
'num_channels': 0,
|
||||
'num_connected': 0,
|
||||
'num_gossipers': 0,
|
||||
'num_utxos': 1,
|
||||
'warning_no_address': 'NO PUBLIC ADDRESSES'
|
||||
}
|
||||
for k, v in expected.items():
|
||||
assert(s[k] == v)
|
||||
|
||||
Reference in New Issue
Block a user