pytest: test for escapes in commando values.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-09-13 06:44:20 +09:30
committed by Christian Decker
parent 746b5f3691
commit 897245e3b7

View File

@@ -2636,6 +2636,7 @@ def test_commando(node_factory, executor):
assert exc_info.value.error['data']['erring_index'] == 0
@pytest.mark.xfail(reason="Escapes in restrictions are broken", strict=True)
def test_commando_rune(node_factory):
l1, l2 = node_factory.get_nodes(2)
@@ -2684,6 +2685,25 @@ def test_commando_rune(node_factory):
assert rune9['rune'] == 'O8Zr-ULTBKO3_pKYz0QKE9xYl1vQ4Xx9PtlHuist9Rk9NCZwbnVtPTAmcmF0ZT0zJnJhdGU9MQ=='
assert rune9['unique_id'] == '4'
# Test rune with \|.
weirdrune = l1.rpc.commando_rune(restrictions=["method=invoice",
"pnamedescription=@tipjar\\|jb55@sendsats.lol"])
with pytest.raises(RpcError, match='Not authorized:'):
l2.rpc.call(method='commando',
payload={'peer_id': l1.info['id'],
'rune': weirdrune['rune'],
'method': 'invoice',
'params': {"amount_msat": "any",
"label": "lbl",
"description": "@tipjar\\|jb55@sendsats.lol"}})
l2.rpc.call(method='commando',
payload={'peer_id': l1.info['id'],
'rune': weirdrune['rune'],
'method': 'invoice',
'params': {"amount_msat": "any",
"label": "lbl",
"description": "@tipjar|jb55@sendsats.lol"}})
runedecodes = ((rune1, []),
(rune2, [{'alternatives': ['method^list', 'method^get', 'method=summary'],
'summary': "method (of command) starts with 'list' OR method (of command) starts with 'get' OR method (of command) equal to 'summary'"},