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

Function test_bkpr_report_lightning_cli_csv

tests/test_bookkeeper.py:1331–1352  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

1329
1330
1331def 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)

Callers

nothing calls this directly

Calls 7

wait_forFunction · 0.90
only_oneFunction · 0.90
nextFunction · 0.85
line_graphMethod · 0.80
listpeerchannelsMethod · 0.80
invoiceMethod · 0.45
xpayMethod · 0.45

Tested by

no test coverage detected