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

Function test_rune_method_missing

tests/test_runes.py:602–622  ·  view source on GitHub ↗

Test `checkrune` when `method` parameter not set `method` is negated in the rune.

(node_factory)

Source from the content-addressed store, hash-verified

600
601
602def test_rune_method_missing(node_factory):
603 """Test `checkrune` when `method` parameter not set `method` is negated in the rune."""
604 l1 = node_factory.get_node()
605 rune = l1.rpc.createrune(restrictions=[["method/getinfo"]])['rune']
606
607 with pytest.raises(RpcError, match='Not permitted: method is equal to getinfo'):
608 l1.rpc.checkrune(rune=rune, method='getinfo')
609 assert l1.rpc.checkrune(rune=rune, method='invoice')['valid'] is True
610 with pytest.raises(RpcError, match='Not permitted: method not present'):
611 l1.rpc.checkrune(rune=rune, method=None)
612
613 rune2 = l1.rpc.createrune(restrictions=[["method!"]])['rune']
614 with pytest.raises(RpcError, match='Not permitted: method is present'):
615 l1.rpc.checkrune(rune=rune2, method='getinfo')
616
617 with pytest.raises(RpcError, match='Not permitted: method is present'):
618 l1.rpc.checkrune(rune=rune2, method='')
619
620 # These two are equivalent (our Python wrapper removes None params)
621 l1.rpc.checkrune(rune=rune2)
622 l1.rpc.checkrune(rune=rune2, method=None)
623
624
625def test_invalid_restrictions(node_factory):

Callers

nothing calls this directly

Calls 1

get_nodeMethod · 0.45

Tested by

no test coverage detected