mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
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:
parent
02717c73dc
commit
ebee48ca8c
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user