diff --git a/CHANGELOG.md b/CHANGELOG.md index b4f687823..90f97aba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ at anytime. ### Fixed * incorrectly raised download cancelled error for already verified blob files * infinite loop where reflector client keeps trying to send failing blobs, which may be failing because they are invalid and thus will never be successfully received - * regression in `stream_availability` due to error in it's docstring + * docstring bugs for `stream_availability`, `channel_import`, and `blob_announce` ### Deprecated * @@ -27,7 +27,7 @@ at anytime. ### Added * `blob_reflect` command to send specific blobs to a reflector server - * + * unit test for docopt ### Removed * `flags` decorator from server.py as short flags are no longer used when using api/cli methods diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index f09c64290..348481c74 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -1936,8 +1936,7 @@ class Daemon(AuthJSONRPCServer): Import serialized channel signing information (to allow signing new claims to the channel) Usage: - channel_import ( | - --serialized_certificate_info=) + channel_import ( | --serialized_certificate_info=) Options: --serialized_certificate_info= : (str) certificate info @@ -2920,18 +2919,17 @@ class Daemon(AuthJSONRPCServer): return d @defer.inlineCallbacks - def jsonrpc_blob_announce(self, announce_all=None, blob_hash=None, - stream_hash=None, sd_hash=None): + def jsonrpc_blob_announce(self, blob_hash=None, stream_hash=None, sd_hash=None, announce_all=None): """ Announce blobs to the DHT Usage: - blob_announce [--announce_all] [ | --blob_hash=] - [ | --stream_hash=] - [ | --sd_hash=] + blob_announce [ | --blob_hash=] + [ | --stream_hash=] | [ | --sd_hash=] + [--announce_all] Options: - --announce_all= : (bool) announce all the blobs possessed by user + --announce_all : (bool) announce all the blobs possessed by user --blob_hash= : (str) announce a blob, specified by blob_hash --stream_hash= : (str) announce all blobs associated with stream_hash diff --git a/lbrynet/tests/unit/lbrynet_daemon/test_DaemonCLI.py b/lbrynet/tests/unit/lbrynet_daemon/test_DaemonCLI.py index 5054c8912..abe487b97 100644 --- a/lbrynet/tests/unit/lbrynet_daemon/test_DaemonCLI.py +++ b/lbrynet/tests/unit/lbrynet_daemon/test_DaemonCLI.py @@ -1,5 +1,7 @@ +import docopt from twisted.trial import unittest from lbrynet.daemon import DaemonCLI +from lbrynet.daemon.Daemon import Daemon class DaemonCLITests(unittest.TestCase): @@ -29,3 +31,17 @@ class DaemonCLITests(unittest.TestCase): self.assertEqual('3', DaemonCLI.guess_type('3', key="channel_name")) self.assertEqual(3, DaemonCLI.guess_type('3', key="some_other_thing")) + + +class DaemonDocsTests(unittest.TestCase): + def test_can_parse_api_method_docs(self): + failures = [] + for name, fn in Daemon.callable_methods.iteritems(): + try: + docopt.docopt(fn.__doc__, ()) + except docopt.DocoptLanguageError as err: + failures.append("invalid docstring for %s, %s" % (name, err.message)) + except docopt.DocoptExit: + pass + if failures: + self.fail("\n" + "\n".join(failures))