Duplicate of allmydata.test.test_tor_provider.Provider.test_handler_socks_endpoint

This commit is contained in:
Jean-Paul Calderone 2020-12-16 11:03:37 -05:00
parent ec9851f6d8
commit 71ced4c228
2 changed files with 4 additions and 11 deletions

View File

@ -67,17 +67,6 @@ class CreateConnectionHandlersTests(SyncTestCase):
class Tor(unittest.TestCase):
def test_default(self):
h1 = mock.Mock()
with mock.patch("foolscap.connections.tor.default_socks",
return_value=h1) as f:
config = config_from_string("fake.port", "no-basedir", BASECONFIG)
tor_provider = create_tor_provider(reactor, config)
h = tor_provider.get_tor_handler()
self.assertEqual(f.mock_calls, [mock.call()])
self.assertIdentical(h, h1)
def _do_test_launch(self, executable):
# the handler is created right away
config = BASECONFIG+"[tor]\nlaunch = true\n"

View File

@ -349,6 +349,10 @@ class Provider(unittest.TestCase):
cfs2.assert_called_with(reactor, ep_desc)
def test_handler_socks_endpoint(self):
"""
If not configured otherwise, the Tor provider returns a Socks-based
handler.
"""
tor = mock.Mock()
handler = object()
tor.socks_endpoint = mock.Mock(return_value=handler)