Merge branch PR392

closes #392
closes ticket:2860
This commit is contained in:
Brian Warner 2017-01-10 16:30:18 -08:00
commit 5e1d464a65
2 changed files with 16 additions and 1 deletions

View File

@ -214,7 +214,10 @@ def write_node_config(c, config):
if config["hide-ip"]:
c.write("[connections]\n")
c.write("tcp = tor\n")
if tor_provider._import_txtorcon():
c.write("tcp = tor\n")
else:
c.write("tcp = disabled\n")
c.write("\n")
c.write("[node]\n")

View File

@ -109,6 +109,18 @@ class Config(unittest.TestCase):
self.assertEqual(cfg.getboolean("node", "reveal-IP-address"), False)
self.assertEqual(cfg.get("connections", "tcp"), "tor")
@defer.inlineCallbacks
def test_client_hide_ip_no_txtorcon(self):
txtorcon = mock.patch('allmydata.util.tor_provider._import_txtorcon',
return_value=None)
with txtorcon:
basedir = self.mktemp()
rc, out, err = yield run_cli("create-client", "--hide-ip", basedir)
self.assertEqual(0, rc)
cfg = read_config(basedir)
self.assertEqual(cfg.getboolean("node", "reveal-IP-address"), False)
self.assertEqual(cfg.get("connections", "tcp"), "disabled")
@defer.inlineCallbacks
def test_client_basedir_exists(self):
basedir = self.mktemp()