mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
pytest: Bypass schema verification for some RPC calls
The goal here is to test the node validation, not whether we can trigger the schema validation with bogus values. So we bypass the verifying RPC wrapper.
This commit is contained in:
parent
93b315756f
commit
6adb1e0b4b
2 changed files with 35 additions and 19 deletions
32
contrib/pyln-testing/pyln/testing/node_pb2.py
generated
32
contrib/pyln-testing/pyln/testing/node_pb2.py
generated
File diff suppressed because one or more lines are too long
|
@ -2046,8 +2046,17 @@ def test_setchannel_usage(node_factory, bitcoind):
|
|||
|
||||
# check if negative fees raise error and DB keeps values
|
||||
# JSONRPC2_INVALID_PARAMS := -32602
|
||||
from pyln.client import LightningRpc
|
||||
with pytest.raises(RpcError, match=r'-32602'):
|
||||
l1.rpc.setchannel(scid, -1, -1)
|
||||
# Need to bypass pyln since it'd check args locally. We also
|
||||
# have to sidestep the schema validation, it attempts to
|
||||
# instantiate Millisatoshis and fails due to the non-negative
|
||||
# constraint.
|
||||
LightningRpc.call(l1.rpc, 'setchannel', {
|
||||
"id": scid,
|
||||
"feebase": -1,
|
||||
"feeppm": -1
|
||||
})
|
||||
|
||||
# test if zero fees is possible
|
||||
result = l1.rpc.setchannel(scid, 0, 0)
|
||||
|
@ -2092,11 +2101,18 @@ def test_setchannel_usage(node_factory, bitcoind):
|
|||
|
||||
# check if 'ppm' values greater than u32_max fail
|
||||
with pytest.raises(RpcError, match=r'-32602.*ppm: should be an integer: invalid token'):
|
||||
l1.rpc.setchannel(scid, 0, 2**32)
|
||||
LightningRpc.call(l1.rpc, 'setchannel', payload={
|
||||
"id": scid,
|
||||
'feebase': 0,
|
||||
'feeppm': 2**32,
|
||||
})
|
||||
|
||||
# check if 'base' values greater than u32_max fail
|
||||
with pytest.raises(RpcError, match=r'-32602.*base: exceeds u32 max: invalid token'):
|
||||
l1.rpc.setchannel(scid, 2**32)
|
||||
LightningRpc.call(l1.rpc, 'setchannel', payload={
|
||||
"id": scid,
|
||||
"feebase": 2**32,
|
||||
})
|
||||
|
||||
|
||||
@pytest.mark.developer("gossip without DEVELOPER=1 is slow")
|
||||
|
|
Loading…
Add table
Reference in a new issue