From b1c0567c98ccad3928381af30f1cea90383c92d1 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 20 Jan 2018 12:06:25 -0600 Subject: [PATCH] fixed int bug in netcontroller and test --- onionr/netcontroller.py | 3 ++- onionr/tests.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/onionr/netcontroller.py b/onionr/netcontroller.py index 05261aa7..7607bcba 100644 --- a/onionr/netcontroller.py +++ b/onionr/netcontroller.py @@ -30,8 +30,9 @@ class NetController: self.myID = '' if os.path.exists(self.torConfigLocation): torrc = open(self.torConfigLocation, 'r') - if not self.hsPort in torrc.read(): + if not str(self.hsPort) in torrc.read(): os.remove(self.torConfigLocation) + torrc.close() return def generateTorrc(self): if os.path.exists(self.torConfigLocation): diff --git a/onionr/tests.py b/onionr/tests.py index 7c4771ac..60c28de3 100755 --- a/onionr/tests.py +++ b/onionr/tests.py @@ -82,12 +82,14 @@ class OnionrTests(unittest.TestCase): def testPGPGen(self): print('--------------------------') print('Testing PGP key generation') - torID = open('data/hs/hostname').read() if os.path.exists('data/pgp/'): self.assertTrue(True) else: - import core + import core, netcontroller myCore = core.Core() + net = netcontroller.NetController(1337) + net.startTor() + torID = open('data/hs/hostname').read() myCore.generateMainPGP(torID) if os.path.exists('data/pgp/'): self.assertTrue(True)