add some missing docstrings

This commit is contained in:
Jean-Paul Calderone 2023-07-19 11:35:51 -04:00
parent 9d7fb6cb08
commit e6b3b65810
2 changed files with 24 additions and 0 deletions

View File

@ -47,6 +47,13 @@ class Config(unittest.TestCase):
self.assertIn("option %s not recognized" % (option,), str(e))
async def test_create_client_config(self):
"""
``create_node.write_client_config`` writes a configuration file
that can be parsed.
TODO Maybe we should test that we can recover the given configuration
from the parse, too.
"""
d = self.mktemp()
os.mkdir(d)
fname = os.path.join(d, 'tahoe.cfg')
@ -289,6 +296,10 @@ class Config(unittest.TestCase):
@defer.inlineCallbacks
def test_node_slow(self):
"""
A node can be created using a listener type that returns an
unfired Deferred from its ``create_config`` method.
"""
d = defer.Deferred()
slow = StaticProvider(True, False, d, None)
create_node._LISTENERS["xxyzy"] = slow
@ -384,6 +395,10 @@ class Tor(unittest.TestCase):
self.assertEqual(cfg.get("node", "tub.location"), "jkl")
def test_launch(self):
"""
The ``--tor-launch`` command line option sets ``tor-launch`` to
``True``.
"""
basedir = self.mktemp()
config_d = defer.succeed(None)
@ -400,6 +415,10 @@ class Tor(unittest.TestCase):
self.assertEqual(args[1]["tor-control-port"], None)
def test_control_port(self):
"""
The ``--tor-control-port`` command line parameter's value is
passed along as the ``tor-control-port`` value.
"""
basedir = self.mktemp()
config_d = defer.succeed(None)

View File

@ -109,6 +109,11 @@ def _connect_to_i2p(reactor, cli_config, txi2p):
raise ValueError("unable to reach any default I2P SAM port")
async def create_config(reactor: Any, cli_config: Any) -> ListenerConfig:
"""
For a given set of command-line options, construct an I2P listener.
This includes allocating a new I2P address.
"""
txi2p = _import_txi2p()
if not txi2p:
raise ValueError("Cannot create I2P Destination without txi2p. "