forked from LBRYCommunity/lbry-sdk
fix docstrings
-add docopt unit test
This commit is contained in:
parent
a9fd19e6cf
commit
439a0f8778
3 changed files with 24 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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> |
|
||||
--serialized_certificate_info=<serialized_certificate_info>)
|
||||
channel_import (<serialized_certificate_info> | --serialized_certificate_info=<serialized_certificate_info>)
|
||||
|
||||
Options:
|
||||
--serialized_certificate_info=<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> | --blob_hash=<blob_hash>]
|
||||
[<stream_hash> | --stream_hash=<stream_hash>]
|
||||
[<sd_hash> | --sd_hash=<sd_hash>]
|
||||
blob_announce [<blob_hash> | --blob_hash=<blob_hash>]
|
||||
[<stream_hash> | --stream_hash=<stream_hash>] | [<sd_hash> | --sd_hash=<sd_hash>]
|
||||
[--announce_all]
|
||||
|
||||
Options:
|
||||
--announce_all=<announce_all> : (bool) announce all the blobs possessed by user
|
||||
--announce_all : (bool) announce all the blobs possessed by user
|
||||
--blob_hash=<blob_hash> : (str) announce a blob, specified by blob_hash
|
||||
--stream_hash=<stream_hash> : (str) announce all blobs associated with
|
||||
stream_hash
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue