adjust test to use new stringvalidation module

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

View File

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