pytest: test checkrune when method parameter is the empty string.

Add test `test_rune_method_not_equal_and_method_empty` that reproduces
issue #6725.

This fails currently, so next commit fix it up.

Error:

```
>       with pytest.raises(RpcError, match='Not permitted: method not present'):
E       Failed: DID NOT RAISE <class 'pyln.client.lightning.RpcError'>

tests/test_runes.py:605: Failed
```
This commit is contained in:
Tony Aldon 2023-10-10 18:29:43 +02:00 committed by Vincenzo Palazzo
parent 02717c73dc
commit ebee48ca8c

View File

@ -594,6 +594,18 @@ def test_missing_method_or_nodeid(node_factory):
l1.rpc.checkrune(rune=rune4, nodeid=l1.info['id'])
def test_rune_method_not_equal_and_method_empty(node_factory):
"""Test `checkrune` when `method` parameter is the empty string and a `method` is negated in the rune."""
l1 = node_factory.get_node()
rune = l1.rpc.createrune(restrictions=[["method/getinfo"]])['rune']
with pytest.raises(RpcError, match='Not permitted: method is equal to getinfo'):
l1.rpc.checkrune(rune=rune, method='getinfo')
assert l1.rpc.checkrune(rune=rune, method='invoice')['valid'] is True
with pytest.raises(RpcError, match='Not permitted: method not present'):
l1.rpc.checkrune(rune=rune, method='')
def test_invalid_restrictions(node_factory):
# I meant "method!" not "!method"!
l1 = node_factory.get_node()