Fix tests, remove debug code

master
Arinerron 2018-04-20 18:26:46 -07:00
parent 2126138428
commit 8d8f167d7f
No known key found for this signature in database
GPG Key ID: 99383627861C62F0
2 changed files with 28 additions and 8 deletions

View File

@ -74,7 +74,6 @@ class Onionr:
else: else:
self._developmentMode = False self._developmentMode = False
logger.set_level(logger.LEVEL_INFO) logger.set_level(logger.LEVEL_INFO)
print('enabled? ' + str(self._developmentMode))
self.onionrCore = core.Core() self.onionrCore = core.Core()
self.onionrUtils = OnionrUtils(self.onionrCore) self.onionrUtils = OnionrUtils(self.onionrCore)
@ -211,10 +210,10 @@ class Onionr:
def addHelp(self, command, description): def addHelp(self, command, description):
self.cmdhelp[str(command).lower()] = str(description) self.cmdhelp[str(command).lower()] = str(description)
def delCommand(self, command): def delCommand(self, command):
return self.cmds.pop(str(command).lower(), None) return self.cmds.pop(str(command).lower(), None)
def delHelp(self, command): def delHelp(self, command):
return self.cmdhelp.pop(str(command).lower(), None) return self.cmdhelp.pop(str(command).lower(), None)
@ -246,7 +245,7 @@ class Onionr:
command = commands.get(argument, self.notFound) command = commands.get(argument, self.notFound)
command() command()
return return
''' '''
@ -262,7 +261,7 @@ class Onionr:
logger.info(ONIONR_TAGLINE) logger.info(ONIONR_TAGLINE)
if verbosity >= 2: if verbosity >= 2:
logger.info('Running on ' + platform.platform() + ' ' + platform.release()) logger.info('Running on ' + platform.platform() + ' ' + platform.release())
return return
def sendEncrypt(self): def sendEncrypt(self):

View File

@ -129,7 +129,14 @@ class OnionrTests(unittest.TestCase):
logger.debug('-'*26 + '\n') logger.debug('-'*26 + '\n')
logger.info('Running simple plugin reload test...') logger.info('Running simple plugin reload test...')
import onionrplugins import onionrplugins, os
if not onionrplugins.exists('test'):
os.makedirs(onionrplugins.get_plugins_folder('test'))
with open(onionrplugins.get_plugins_folder('test') + '/main.py', 'a') as main:
main.write("print('Running')\n\ndef on_test(onionr = None, data = None):\n print('received test event!')\n return True\n\ndef on_start(onionr = None, data = None):\n print('start event called')\n\ndef on_stop(onionr = None, data = None):\n print('stop event called')\n\ndef on_enable(onionr = None, data = None):\n print('enable event called')\n\ndef on_disable(onionr = None, data = None):\n print('disable event called')\n")
onionrplugins.enable('test')
try: try:
onionrplugins.reload('test') onionrplugins.reload('test')
self.assertTrue(True) self.assertTrue(True)
@ -140,7 +147,14 @@ class OnionrTests(unittest.TestCase):
logger.debug('-'*26 + '\n') logger.debug('-'*26 + '\n')
logger.info('Running simple plugin restart test...') logger.info('Running simple plugin restart test...')
import onionrplugins import onionrplugins, os
if not onionrplugins.exists('test'):
os.makedirs(onionrplugins.get_plugins_folder('test'))
with open(onionrplugins.get_plugins_folder('test') + '/main.py', 'a') as main:
main.write("print('Running')\n\ndef on_test(onionr = None, data = None):\n print('received test event!')\n return True\n\ndef on_start(onionr = None, data = None):\n print('start event called')\n\ndef on_stop(onionr = None, data = None):\n print('stop event called')\n\ndef on_enable(onionr = None, data = None):\n print('enable event called')\n\ndef on_disable(onionr = None, data = None):\n print('disable event called')\n")
onionrplugins.enable('test')
try: try:
onionrplugins.start('test') onionrplugins.start('test')
onionrplugins.stop('test') onionrplugins.stop('test')
@ -152,7 +166,14 @@ class OnionrTests(unittest.TestCase):
logger.debug('-'*26 + '\n') logger.debug('-'*26 + '\n')
logger.info('Running plugin event test...') logger.info('Running plugin event test...')
import onionrplugins as plugins, onionrevents as events import onionrplugins as plugins, onionrevents as events, os
if not plugins.exists('test'):
os.makedirs(plugins.get_plugins_folder('test'))
with open(plugins.get_plugins_folder('test') + '/main.py', 'a') as main:
main.write("print('Running')\n\ndef on_test(onionr = None, data = None):\n print('received test event!')\n return True\n\ndef on_start(onionr = None, data = None):\n print('start event called')\n\ndef on_stop(onionr = None, data = None):\n print('stop event called')\n\ndef on_enable(onionr = None, data = None):\n print('enable event called')\n\ndef on_disable(onionr = None, data = None):\n print('disable event called')\n")
plugins.enable('test')
plugins.start('test') plugins.start('test')
if not events.call(plugins.get_plugin('test'), 'test'): if not events.call(plugins.get_plugin('test'), 'test'):