mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
plugins: test for option value checking and parsing
This commit is contained in:
committed by
Rusty Russell
parent
cac5a0cd1d
commit
b25a8ba29d
20
tests/plugins/options.py
Executable file
20
tests/plugins/options.py
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
"""This plugin is used to check that plugin options are parsed properly.
|
||||
|
||||
The plugin offers 3 options, one of each supported type.
|
||||
"""
|
||||
from lightning import Plugin
|
||||
|
||||
plugin = Plugin()
|
||||
|
||||
|
||||
@plugin.init()
|
||||
def init(configuration, options, plugin):
|
||||
for name, val in options.items():
|
||||
plugin.log("option {} {} {}".format(name, val, type(val)))
|
||||
|
||||
|
||||
plugin.add_option('str_opt', 'i am a string', 'an example string option')
|
||||
plugin.add_option('int_opt', 7, 'an example int type option', opt_type='int')
|
||||
plugin.add_option('bool_opt', True, 'an example bool type option', opt_type='bool')
|
||||
plugin.run()
|
||||
Reference in New Issue
Block a user