(node_factory)
| 1329 | |
| 1330 | |
| 1331 | def test_bkpr_report_lightning_cli_csv(node_factory): |
| 1332 | l1, l2 = node_factory.line_graph(2) |
| 1333 | |
| 1334 | # Give desc something awkward so CSV escaping matters if it shows up. |
| 1335 | inv = l2.rpc.invoice(100000, "test_bkpr_report_lightning_cli_csv", 'hello, "csv"') |
| 1336 | l1.rpc.xpay(inv["bolt11"]) |
| 1337 | wait_for(lambda: only_one(l1.rpc.listpeerchannels(l2.info['id'])['channels'])['htlcs'] == []) |
| 1338 | |
| 1339 | # Single-column CSV is enough to validate the CLI path and escaping. |
| 1340 | res = subprocess.check_output(["cli/lightning-cli", |
| 1341 | f"--network={TEST_NETWORK}", |
| 1342 | f"--lightning-dir={l1.daemon.lightning_dir}", |
| 1343 | "-k", |
| 1344 | "bkpr-report", |
| 1345 | 'format={description?"hello, ""fallback"""},{tag},', |
| 1346 | "escape=csv"], |
| 1347 | text=True) |
| 1348 | |
| 1349 | # Must parse cleanly as CSV, one row per returned line. |
| 1350 | parsed = [next(csv.reader(io.StringIO(line))) for line in res.splitlines()] |
| 1351 | assert parsed |
| 1352 | assert all(len(row) == 3 for row in parsed) |
nothing calls this directly
no test coverage detected