Skip to content

Commit

Permalink
pyln-client: adds testcase for usage in manifest and print_usage
Browse files Browse the repository at this point in the history
  • Loading branch information
m-schmoock authored and rustyrussell committed Nov 19, 2024
1 parent 49aaab5 commit 5fe0c1c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions contrib/pyln-client/tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,22 @@ def test4(request):
ba = p._bind_kwargs(test4, {}, req)
with pytest.raises(ValueError, match=r'current state is RequestState\.FINISHED(.*\n*.*)*MARKER4'):
test4(*ba.args)


def test_usage():
p = Plugin(autopatch=False)

@p.method("some_method")
def some_method(some_arg: str = None):
"""some description"""
pass

manifest = p._getmanifest()
usage = p.get_usage()

assert manifest['rpcmethods'][0]['name'] == 'some_method'
assert "some_arg" in manifest['rpcmethods'][0]['usage']
assert "some description" in manifest['rpcmethods'][0]['usage']
assert "some_method" in usage
assert "some_arg" in usage
assert "some description" in usage

0 comments on commit 5fe0c1c

Please sign in to comment.