MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_rune_error_messages

Function test_rune_error_messages

tests/test_runes.py:682–725  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

680
681
682def test_rune_error_messages(node_factory):
683 l1 = node_factory.get_node()
684
685 rune1 = l1.rpc.createrune(restrictions=[['method=pay'],
686 ['pnum=1']])['rune']
687 with pytest.raises(RpcError, match='Not permitted: number of parameters is not equal to 1'):
688 l1.rpc.checkrune(nodeid=l1.info['id'],
689 rune=rune1,
690 method='pay',
691 params=['xxx', 12000])
692 with pytest.raises(RpcError, match='Not permitted: number of parameters is not equal to 1'):
693 l1.rpc.checkrune(nodeid=l1.info['id'],
694 rune=rune1,
695 method='pay',
696 params={'bolt11': 'xxx', 'amount_msat': 17})
697
698 rune2 = l1.rpc.createrune(restrictions=[['method=pay'],
699 ['parr1=17']])['rune']
700
701 with pytest.raises(RpcError, match='Not permitted: parameter #1 is not equal to 17'):
702 l1.rpc.checkrune(nodeid=l1.info['id'],
703 rune=rune2,
704 method='pay',
705 params=['xxx', 12000])
706
707 with pytest.raises(RpcError, match='Not permitted: parameter #1 not present'):
708 l1.rpc.checkrune(nodeid=l1.info['id'],
709 rune=rune2,
710 method='pay',
711 params={'bolt11': 'xxx', 'amount_msat': 12000})
712
713 rune3 = l1.rpc.createrune(restrictions=[['method=pay'],
714 ['pnamebolt11=xxx']])['rune']
715
716 with pytest.raises(RpcError, match='Not permitted: parameter bolt11 is not equal to xxx'):
717 l1.rpc.checkrune(nodeid=l1.info['id'],
718 rune=rune3,
719 method='pay',
720 params={'bolt11': 'yyy', 'amount_msat': 12000})
721 with pytest.raises(RpcError, match='Not permitted: parameter bolt11 not present'):
722 l1.rpc.checkrune(nodeid=l1.info['id'],
723 rune=rune3,
724 method='pay',
725 params=['xxx', 12000])
726
727
728def test_rune_bolt11_parse(node_factory):

Callers

nothing calls this directly

Calls 1

get_nodeMethod · 0.45

Tested by

no test coverage detected