Test `checkrune` when `method` parameter not set `method` is negated in the rune.
(node_factory)
| 600 | |
| 601 | |
| 602 | def 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 | |
| 625 | def test_invalid_restrictions(node_factory): |