This test includes all possible combinations of input error inside the delpay command.
(node_factory, bitcoind)
| 4074 | |
| 4075 | |
| 4076 | def test_delpay_argument_invalid(node_factory, bitcoind): |
| 4077 | """ |
| 4078 | This test includes all possible combinations of input error inside the |
| 4079 | delpay command. |
| 4080 | """ |
| 4081 | |
| 4082 | # Create the line graph l2 -> l1 with a channel of 10 ** 5 sat! |
| 4083 | l2, l1 = node_factory.line_graph(2, fundamount=10**5, wait_for_announce=True) |
| 4084 | |
| 4085 | l2.rpc.check_request_schemas = False |
| 4086 | with pytest.raises(RpcError): |
| 4087 | l2.rpc.delpay() |
| 4088 | l2.rpc.check_request_schemas = True |
| 4089 | |
| 4090 | # sanity check |
| 4091 | inv = l1.rpc.invoice(10 ** 5, 'inv', 'inv') |
| 4092 | payment_hash = "AA" * 32 |
| 4093 | with pytest.raises(RpcError): |
| 4094 | l2.rpc.delpay(payment_hash, 'complete') |
| 4095 | |
| 4096 | l2.rpc.pay(inv['bolt11']) |
| 4097 | |
| 4098 | wait_for(lambda: l2.rpc.listpays(inv['bolt11'])['pays'][0]['status'] == 'complete') |
| 4099 | |
| 4100 | payment_hash = inv['payment_hash'] |
| 4101 | |
| 4102 | # payment paid with wrong status (pending status is a illegal input) |
| 4103 | l2.rpc.check_request_schemas = False |
| 4104 | with pytest.raises(RpcError): |
| 4105 | l2.rpc.delpay(payment_hash, 'pending') |
| 4106 | |
| 4107 | with pytest.raises(RpcError): |
| 4108 | l2.rpc.delpay(payment_hash, 'invalid_status') |
| 4109 | l2.rpc.check_request_schemas = True |
| 4110 | |
| 4111 | with pytest.raises(RpcError): |
| 4112 | l2.rpc.delpay(payment_hash, 'failed') |
| 4113 | |
| 4114 | # test if the node is still ready |
| 4115 | payments = l2.rpc.delpay(payment_hash, 'complete') |
| 4116 | |
| 4117 | assert payments['payments'][0]['bolt11'] == inv['bolt11'] |
| 4118 | assert len(payments['payments']) == 1 |
| 4119 | assert len(l2.rpc.listpays()['pays']) == 0 |
| 4120 | |
| 4121 | |
| 4122 | def test_delpay_mixed_status(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected