Skip to content

Commit 9d7afba

Browse files
ShahanaFarooquirustyrussell
authored andcommitted
tests: commando-listrunes
1 parent 3e310a3 commit 9d7afba

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/test_plugin.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2945,6 +2945,43 @@ def test_commando_rune(node_factory):
29452945
'params': params})
29462946

29472947

2948+
def test_commando_listrunes(node_factory):
2949+
l1 = node_factory.get_node()
2950+
rune = l1.rpc.commando_rune()
2951+
assert rune == {
2952+
'rune': 'OSqc7ixY6F-gjcigBfxtzKUI54uzgFSA6YfBQoWGDV89MA==',
2953+
'unique_id': '0',
2954+
'warning_unrestricted_rune': 'WARNING: This rune has no restrictions! Anyone who has access to this rune could drain funds from your node. Be careful when giving this to apps that you don\'t trust. Consider using the restrictions parameter to only allow access to specific rpc methods.'
2955+
}
2956+
listrunes = l1.rpc.commando_listrunes()
2957+
assert len(l1.rpc.commando_listrunes()) == 1
2958+
rune = l1.rpc.commando_rune()
2959+
listrunes = l1.rpc.commando_listrunes()
2960+
assert len(listrunes['runes']) == 2
2961+
assert listrunes == {
2962+
'runes': [
2963+
{
2964+
'rune': 'OSqc7ixY6F-gjcigBfxtzKUI54uzgFSA6YfBQoWGDV89MA==',
2965+
'unique_id': '0',
2966+
'restrictions': [],
2967+
'restrictions_as_english': ''
2968+
},
2969+
{
2970+
'rune': 'geZmO6U7yqpHn-moaX93FVMVWrDRfSNY4AXx9ypLcqg9MQ==',
2971+
'unique_id': '1',
2972+
'restrictions': [],
2973+
'restrictions_as_english': ''
2974+
}
2975+
]
2976+
}
2977+
our_unstored_rune = l1.rpc.commando_listrunes(rune='M8f4jNx9gSP2QoiRbr10ybwzFxUgd-rS4CR4yofMSuA9Mg==')['runes'][0]
2978+
assert our_unstored_rune['stored'] is False
2979+
2980+
not_our_rune = l1.rpc.commando_listrunes(rune='Am3W_wI0PRn4qVNEsJ2iInHyFPQK8wfdqEXztm8-icQ9MA==')['runes'][0]
2981+
assert not_our_rune['stored'] is False
2982+
assert not_our_rune['our_rune'] is False
2983+
2984+
29482985
def test_commando_stress(node_factory, executor):
29492986
"""Stress test to slam commando with many large queries"""
29502987
nodes = node_factory.get_nodes(5)

0 commit comments

Comments
 (0)