test: refactor plugin to use parameter not envvar
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
5932d3b766
commit
51e6387c8d
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from pyln.client import Plugin
|
||||
import os
|
||||
|
||||
# Register a different set feature of feature bits for each location so we can
|
||||
# later check that they are being passed correctly.
|
||||
@@ -15,10 +14,10 @@ plugin = Plugin(
|
||||
|
||||
@plugin.init()
|
||||
def init(configuration, options, plugin):
|
||||
disable = os.getenv("PLUGIN_DISABLE")
|
||||
if disable:
|
||||
if options.get('disable-on-init'):
|
||||
return {'disable': 'init saying disable'}
|
||||
return {}
|
||||
|
||||
|
||||
plugin.add_option('disable-on-init', False, 'disable plugin on init', opt_type='bool')
|
||||
plugin.run()
|
||||
|
||||
@@ -1748,7 +1748,7 @@ def test_plugin_feature_announce(node_factory):
|
||||
assert node['features'] == expected_node_features(extra=[203])
|
||||
|
||||
|
||||
def test_plugin_feature_remove(node_factory, monkeypatch):
|
||||
def test_plugin_feature_remove(node_factory):
|
||||
"""Check that features registered by plugins get removed if a plugin
|
||||
disables itself.
|
||||
|
||||
@@ -1759,9 +1759,8 @@ def test_plugin_feature_remove(node_factory, monkeypatch):
|
||||
- 1 << 205 for bolt11 invoices
|
||||
"""
|
||||
|
||||
monkeypatch.setenv("PLUGIN_DISABLE", "1")
|
||||
plugin = os.path.join(os.path.dirname(__file__), 'plugins/feature-test.py')
|
||||
l1 = node_factory.get_node(options={'plugin': plugin})
|
||||
l1 = node_factory.get_node(options={'plugin': plugin, 'disable-on-init': True})
|
||||
|
||||
# Check that we don't include the features set in getmanifest.
|
||||
our_feats = l1.rpc.getinfo()["our_features"]
|
||||
|
||||
Reference in New Issue
Block a user