Skip to content

Commit 5fe0c1c

Browse files
m-schmoockrustyrussell
authored andcommitted
pyln-client: adds testcase for usage in manifest and print_usage
1 parent 49aaab5 commit 5fe0c1c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

contrib/pyln-client/tests/test_plugin.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,3 +435,22 @@ def test4(request):
435435
ba = p._bind_kwargs(test4, {}, req)
436436
with pytest.raises(ValueError, match=r'current state is RequestState\.FINISHED(.*\n*.*)*MARKER4'):
437437
test4(*ba.args)
438+
439+
440+
def test_usage():
441+
p = Plugin(autopatch=False)
442+
443+
@p.method("some_method")
444+
def some_method(some_arg: str = None):
445+
"""some description"""
446+
pass
447+
448+
manifest = p._getmanifest()
449+
usage = p.get_usage()
450+
451+
assert manifest['rpcmethods'][0]['name'] == 'some_method'
452+
assert "some_arg" in manifest['rpcmethods'][0]['usage']
453+
assert "some description" in manifest['rpcmethods'][0]['usage']
454+
assert "some_method" in usage
455+
assert "some_arg" in usage
456+
assert "some description" in usage

0 commit comments

Comments
 (0)