fixed int bug in netcontroller and test

master
Kevin Froman 2018-01-20 12:06:25 -06:00
parent 26c1983a61
commit b1c0567c98
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
2 changed files with 6 additions and 3 deletions

View File

@ -30,8 +30,9 @@ class NetController:
self.myID = '' self.myID = ''
if os.path.exists(self.torConfigLocation): if os.path.exists(self.torConfigLocation):
torrc = open(self.torConfigLocation, 'r') torrc = open(self.torConfigLocation, 'r')
if not self.hsPort in torrc.read(): if not str(self.hsPort) in torrc.read():
os.remove(self.torConfigLocation) os.remove(self.torConfigLocation)
torrc.close()
return return
def generateTorrc(self): def generateTorrc(self):
if os.path.exists(self.torConfigLocation): if os.path.exists(self.torConfigLocation):

View File

@ -82,12 +82,14 @@ class OnionrTests(unittest.TestCase):
def testPGPGen(self): def testPGPGen(self):
print('--------------------------') print('--------------------------')
print('Testing PGP key generation') print('Testing PGP key generation')
torID = open('data/hs/hostname').read()
if os.path.exists('data/pgp/'): if os.path.exists('data/pgp/'):
self.assertTrue(True) self.assertTrue(True)
else: else:
import core import core, netcontroller
myCore = core.Core() myCore = core.Core()
net = netcontroller.NetController(1337)
net.startTor()
torID = open('data/hs/hostname').read()
myCore.generateMainPGP(torID) myCore.generateMainPGP(torID)
if os.path.exists('data/pgp/'): if os.path.exists('data/pgp/'):
self.assertTrue(True) self.assertTrue(True)