mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 08:34:20 +01:00
json_command: command_fail_badparam helper.
It's common to want to complain a token is not what we expected. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1610,7 +1610,7 @@ def test_configfile_before_chdir(node_factory):
|
||||
def test_json_error(node_factory):
|
||||
"""Must return valid json even if it quotes our weirdness"""
|
||||
l1 = node_factory.get_node()
|
||||
with pytest.raises(RpcError, match=r'Given id is not a channel ID or short channel ID'):
|
||||
with pytest.raises(RpcError, match=r'id: should be a channel ID or short channel ID: invalid token'):
|
||||
l1.rpc.close({"tx": "020000000001011490f737edd2ea2175a032b58ea7cd426dfc244c339cd044792096da3349b18a0100000000ffffffff021c900300000000001600140e64868e2f752314bc82a154c8c5bf32f3691bb74da00b00000000002200205b8cd3b914cf67cdd8fa6273c930353dd36476734fbd962102c2df53b90880cd0247304402202b2e3195a35dc694bbbc58942dc9ba59cc01d71ba55c9b0ad0610ccd6a65633702201a849254453d160205accc00843efb0ad1fe0e186efa6a7cee1fb6a1d36c736a012103d745445c9362665f22e0d96e9e766f273f3260dea39c8a76bfa05dd2684ddccf00000000", "txid": "2128c10f0355354479514f4a23eaa880d94e099406d419bbb0d800143accddbb", "channel_id": "bbddcc3a1400d8b0bb19d40694094ed980a8ea234a4f5179443555030fc12820"})
|
||||
|
||||
# Should not corrupt following RPC
|
||||
@@ -1840,7 +1840,7 @@ def test_dev_demux(node_factory):
|
||||
l1.rpc.check(command_to_check='dev', subcommand='foobar')
|
||||
with pytest.raises(RpcError, match=r'unknown parameter'):
|
||||
l1.rpc.check(command_to_check='dev', subcommand='crash', unk=1)
|
||||
with pytest.raises(RpcError, match=r"'msec' should be an integer"):
|
||||
with pytest.raises(RpcError, match=r"msec: should be an integer: invalid token"):
|
||||
l1.rpc.check(command_to_check='dev', subcommand='slowcmd', msec='aaa')
|
||||
with pytest.raises(RpcError, match=r'missing required parameter'):
|
||||
l1.rpc.check(command_to_check='dev', subcommand='rhash')
|
||||
@@ -1856,9 +1856,9 @@ def test_dev_demux(node_factory):
|
||||
l1.rpc.call('dev', {'subcommand': 'crash', 'unk': 1})
|
||||
with pytest.raises(RpcError, match=r'too many parameters'):
|
||||
l1.rpc.call('dev', ['crash', 1])
|
||||
with pytest.raises(RpcError, match=r"'msec' should be an integer"):
|
||||
with pytest.raises(RpcError, match=r"msec: should be an integer: invalid token"):
|
||||
l1.rpc.call('dev', {'subcommand': 'slowcmd', 'msec': 'aaa'})
|
||||
with pytest.raises(RpcError, match=r"'msec' should be an integer"):
|
||||
with pytest.raises(RpcError, match=r"msec: should be an integer: invalid token"):
|
||||
l1.rpc.call('dev', ['slowcmd', 'aaa'])
|
||||
with pytest.raises(RpcError, match=r'missing required parameter'):
|
||||
l1.rpc.call('dev', {'subcommand': 'rhash'})
|
||||
|
||||
Reference in New Issue
Block a user