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