adjust test to use new stringvalidation module

master
Kevin Froman 2019-06-25 19:32:44 -05:00
parent 122eb4ee5f
commit a5a50a84d4
2 changed files with 66 additions and 67 deletions

View File

@ -42,7 +42,7 @@ class Core:
if not self.dataDir.endswith('/'): if not self.dataDir.endswith('/'):
self.dataDir += '/' self.dataDir += '/'
#try: try:
self.usageFile = self.dataDir + 'disk-usage.txt' self.usageFile = self.dataDir + 'disk-usage.txt'
self.config = config self.config = config
self.maxBlockSize = 10000000 # max block size in bytes self.maxBlockSize = 10000000 # max block size in bytes
@ -107,11 +107,10 @@ class Core:
self._blacklist = onionrblacklist.OnionrBlackList(self) self._blacklist = onionrblacklist.OnionrBlackList(self)
self.serializer = serializeddata.SerializedData(self) self.serializer = serializeddata.SerializedData(self)
# except Exception as error: except Exception as error:
# print(str(error)) logger.error('Failed to initialize core Onionr library.', error=error, terminal=True)
# logger.error('Failed to initialize core Onionr library.', error=error, terminal=True) logger.fatal('Cannot recover from error.', terminal=True)
# logger.fatal('Cannot recover from error.', terminal=True) sys.exit(1)
# sys.exit(1)
return return
def refreshFirstStartVars(self): def refreshFirstStartVars(self):
@ -441,7 +440,7 @@ class Core:
localcommand.local_command(self, '/waitforshare/' + retData, post=True, maxWait=5) localcommand.local_command(self, '/waitforshare/' + retData, post=True, maxWait=5)
self.daemonQueueAdd('uploadBlock', retData) self.daemonQueueAdd('uploadBlock', retData)
else: else:
print('shite', localcommand.local_command(self, '/ping', maxWait=10)) pass
self.addToBlockDB(retData, selfInsert=True, dataSaved=True) self.addToBlockDB(retData, selfInsert=True, dataSaved=True)
blockmetadata.process_block_metadata(self, retData) blockmetadata.process_block_metadata(self, retData)

View File

@ -35,11 +35,11 @@ class OnionrValidations(unittest.TestCase):
for valid in valids: for valid in valids:
print('testing', valid) print('testing', valid)
self.assertTrue(c._utils.validatePubKey(valid)) self.assertTrue(stringvalidators.validate_pub_key(valid))
for x in invalid: for x in invalid:
#print('testing', x) #print('testing', x)
self.assertFalse(c._utils.validatePubKey(x)) self.assertFalse(stringvalidators.validate_pub_key(x))
def test_integer_string(self): def test_integer_string(self):
valid = ["1", "100", 100, "-5", -5] valid = ["1", "100", 100, "-5", -5]