Make sure lightning-cli passes valid json values, so that rust and python plugins don't crash.
(node_factory)
| 997 | |
| 998 | |
| 999 | def 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 | |
| 1023 | def test_cli(node_factory): |