MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_valid_json_cli

Function test_valid_json_cli

tests/test_misc.py:999–1020  ·  view source on GitHub ↗

Make sure lightning-cli passes valid json values, so that rust and python plugins don't crash.

(node_factory)

Source from the content-addressed store, hash-verified

997
998
999def test_valid_json_cli(node_factory):
1000 """Make sure lightning-cli passes valid json values, so that rust and python plugins
1001 don't crash."""
1002 l1 = node_factory.get_node(
1003 options={
1004 "log-level": "io",
1005 "plugin": os.path.join(os.getcwd(), "tests/plugins/validatejson.py"),
1006 }
1007 )
1008 # If passed as a literal number rust's serde_json::from_str will fail as the
1009 # leading zero makes it invalid for an integer.
1010 nodeid = "030000000000000000000000000000000000000000000000000000000000000001"
1011 subprocess.check_output(
1012 [
1013 "cli/lightning-cli",
1014 "--network={}".format(TEST_NETWORK),
1015 "--lightning-dir={}".format(l1.daemon.lightning_dir),
1016 "-k",
1017 "validate-json-rpc",
1018 f"nodeid={nodeid}",
1019 ]
1020 ).decode("utf-8")
1021
1022
1023def test_cli(node_factory):

Callers

nothing calls this directly

Calls 3

joinMethod · 0.80
get_nodeMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected