mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-10 14:34:05 +00:00
Duplicate of allmydata.test.test_tor_provider.Provider.test_handler_socks_endpoint
This commit is contained in:
parent
ec9851f6d8
commit
71ced4c228
@ -67,17 +67,6 @@ class CreateConnectionHandlersTests(SyncTestCase):
|
|||||||
|
|
||||||
class Tor(unittest.TestCase):
|
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):
|
def _do_test_launch(self, executable):
|
||||||
# the handler is created right away
|
# the handler is created right away
|
||||||
config = BASECONFIG+"[tor]\nlaunch = true\n"
|
config = BASECONFIG+"[tor]\nlaunch = true\n"
|
||||||
|
@ -349,6 +349,10 @@ class Provider(unittest.TestCase):
|
|||||||
cfs2.assert_called_with(reactor, ep_desc)
|
cfs2.assert_called_with(reactor, ep_desc)
|
||||||
|
|
||||||
def test_handler_socks_endpoint(self):
|
def test_handler_socks_endpoint(self):
|
||||||
|
"""
|
||||||
|
If not configured otherwise, the Tor provider returns a Socks-based
|
||||||
|
handler.
|
||||||
|
"""
|
||||||
tor = mock.Mock()
|
tor = mock.Mock()
|
||||||
handler = object()
|
handler = object()
|
||||||
tor.socks_endpoint = mock.Mock(return_value=handler)
|
tor.socks_endpoint = mock.Mock(return_value=handler)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user