Add test for 'onionservicesonly' mode.
Credit to Dmitri Bogomolov in commit 557a8cc6d2bec881b8a3c531d3f725460ed515f5.
This commit is contained in:
parent
b42f536d23
commit
f871cd450c
|
@ -173,6 +173,22 @@ class TestCore(unittest.TestCase):
|
|||
self.fail(
|
||||
'Failed to connect during %s sec' % (time.time() - _started))
|
||||
|
||||
def test_onionservicesonly(self):
|
||||
"""test onionservicesonly networking mode"""
|
||||
BMConfigParser().set('bitmessagesettings', 'onionservicesonly', True)
|
||||
self._initiate_bootstrap()
|
||||
BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
|
||||
for _ in range(360):
|
||||
time.sleep(1)
|
||||
for n, peer in enumerate(BMConnectionPool().outboundConnections):
|
||||
if n > 2:
|
||||
return
|
||||
if not peer.host.endswith('.onion'):
|
||||
self.fail(
|
||||
'Found non onion hostname %s in outbound connections!'
|
||||
% peer.host)
|
||||
self.fail('Failed to connect to at least 3 nodes within 360 sec')
|
||||
|
||||
def test_bootstrap(self):
|
||||
"""test bootstrapping"""
|
||||
self._initiate_bootstrap()
|
||||
|
|
Reference in New Issue
Block a user