Removed print debugs in core.py

added daemon queue test
This commit is contained in:
Kevin Froman 2018-01-04 16:15:15 -06:00
parent 7e0d5dec8a
commit fb0309a414
2 changed files with 20 additions and 4 deletions

View File

@ -31,16 +31,13 @@ class Core:
c.execute('''CREATE TABLE commands
(id integer primary key autoincrement, command text, data text, date text)''')
conn.commit()
print('created table')
else:
conn = sqlite3.connect(self.queueDB)
c = conn.cursor()
for row in c.execute('SELECT command, data, date, min(ID) FROM commands group by id'):
retData = row
print(retData)
break
if retData != False:
print('3', retData[3])
c.execute('delete from commands where id = ?', (retData[3],))
conn.commit()
conn.close()

View File

@ -18,11 +18,30 @@ import unittest, sys, os
class OnionrTests(unittest.TestCase):
def testNone(self):
print('--------------------------')
print('Running simple program run test')
# Test just running ./onionr with no arguments
blank = os.system('./onionr.py')
if blank != 0:
self.assertTrue(False)
else:
self.assertTrue(True)
def testQueue(self):
print('--------------------------')
print('running daemon queue test')
# test if the daemon queue can read/write data
import core
myCore = core.Core()
while True:
command = myCore.daemonQueue()
if command == False:
print('The queue is empty (false)')
break
else:
print(command[0])
myCore.daemonQueueAdd('testCommand', 'testData')
command = myCore.daemonQueue()
if command[0] == 'testCommand':
if myCore.daemonQueue() == False:
print('Succesfully added and read command')
unittest.main()