mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-18 17:00:24 +00:00
address review feedback: docstrings, better test class name
This commit is contained in:
parent
097abb42fa
commit
d713e0e57d
@ -401,6 +401,11 @@ class Node(service.MultiService):
|
||||
if port in ("0", "tcp:0"):
|
||||
raise ValueError("tub.port cannot be 0: you must choose")
|
||||
if port == "listen:i2p":
|
||||
# the I2P provider will read its section of tahoe.cfg and
|
||||
# return either a fully-formed Endpoint, or a descriptor
|
||||
# that will create one, so we don't have to stuff all the
|
||||
# options into the tub.port string (which would need a lot
|
||||
# of escaping)
|
||||
port_or_endpoint = self._i2p_provider.get_listener()
|
||||
elif port == "listen:tor":
|
||||
port_or_endpoint = self._tor_provider.get_listener()
|
||||
|
@ -294,8 +294,13 @@ class Provider(unittest.TestCase):
|
||||
self.assertIs(h, handler)
|
||||
i2p.default.assert_called_with(reactor, keyfile=None)
|
||||
|
||||
class Provider_Listener(unittest.TestCase):
|
||||
class ProviderListener(unittest.TestCase):
|
||||
def test_listener(self):
|
||||
"""Does the I2P Provider object's get_listener() method correctly
|
||||
convert the [i2p] section of tahoe.cfg into an
|
||||
endpoint/descriptor?
|
||||
"""
|
||||
|
||||
i2p = mock.Mock()
|
||||
handler = object()
|
||||
i2p.local_i2p = mock.Mock(return_value=handler)
|
||||
|
@ -393,8 +393,12 @@ class Provider(unittest.TestCase):
|
||||
self.assertIs(h, handler)
|
||||
tor.default_socks.assert_called_with()
|
||||
|
||||
class Provider_Listener(unittest.TestCase):
|
||||
class ProviderListener(unittest.TestCase):
|
||||
def test_listener(self):
|
||||
"""Does the Tor Provider object's get_listener() method correctly
|
||||
convert the [tor] section of tahoe.cfg into an
|
||||
endpoint/descriptor?
|
||||
"""
|
||||
tor = mock.Mock()
|
||||
handler = object()
|
||||
tor.socks_endpoint = mock.Mock(return_value=handler)
|
||||
|
Loading…
x
Reference in New Issue
Block a user