Test a large reply still works (and msat fields are integers!)
(node_factory)
| 240 | |
| 241 | |
| 242 | def test_large_response(node_factory): |
| 243 | """Test a large reply still works (and msat fields are integers!)""" |
| 244 | # start a node with clnrest |
| 245 | l1, base_url, ca_cert = start_node_with_clnrest(node_factory) |
| 246 | http_session = http_session_with_retry() |
| 247 | |
| 248 | # Add 500 invoices, test list |
| 249 | NUM_INVOICES = 500 |
| 250 | for i in range(NUM_INVOICES): |
| 251 | l1.rpc.invoice(amount_msat=100, label=str(i), description="inv") |
| 252 | |
| 253 | rune = l1.rpc.createrune()['rune'] |
| 254 | response = http_session.post(base_url + '/v1/listinvoices', headers={'Rune': rune}, |
| 255 | verify=ca_cert) |
| 256 | # No, this doesn't return JSON, it *parses* it into a Python object! |
| 257 | resp = response.json() |
| 258 | |
| 259 | # Make sure it hasn't turned msat fields into strings! |
| 260 | assert not isinstance(resp['invoices'][0]['amount_msat'], Millisatoshi) |
| 261 | assert len(resp['invoices']) == NUM_INVOICES |
| 262 | |
| 263 | |
| 264 | # Tests for websocket are written separately to avoid flake8 |
nothing calls this directly
no test coverage detected