fix tests

This commit is contained in:
Kevin Froman 2020-11-22 00:43:59 +00:00
parent 30a4285b92
commit adba4be099
18 changed files with 78 additions and 36 deletions

View File

@ -18,8 +18,8 @@ conf['general']['display_header'] = True
conf['general']['security_level'] = 0
conf['general']['use_bootstrap_list'] = True
conf['onboarding']['done'] = False
conf['general']['minimum_block_pow'] = 5
conf['general']['minimum_send_pow'] = 5
conf['general']['minimum_block_pow'] = 6
conf['general']['minimum_send_pow'] = 6
conf['log']['file']['remove_on_exit'] = True
conf['transports']['lan'] = True
conf['transports']['tor'] = True

View File

@ -14,8 +14,8 @@
"hide_created_blocks": true,
"insert_deniable_blocks": true,
"max_block_age": 2678400,
"minimum_block_pow": 5,
"minimum_send_pow": 5,
"minimum_block_pow": 6,
"minimum_send_pow": 6,
"public_key": "",
"random_bind_ip": true,
"security_level": 0,
@ -45,8 +45,7 @@
"minimum_score": -100
},
"plugins": {
"disabled": [
],
"disabled": [],
"enabled": []
},
"statistics": {

View File

@ -1 +1 @@
1603867091
1606002757

View File

@ -6,10 +6,14 @@ import unittest, uuid, sqlite3
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
from urllib.request import pathname2url
from coredb import keydb
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from urllib.request import pathname2url
from coredb import keydb
class OnionrTests(unittest.TestCase):
def test_address_add(self):

View File

@ -5,10 +5,12 @@ import unittest, uuid, json
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
import onionrblocks
from utils import createdirs
from utils import readstatic
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from utils import readstatic
import onionrblocks
class OnionrConfig(unittest.TestCase):
def test_default_file(self):
json.loads(readstatic.read_static('default_config.json'))
@ -45,7 +47,7 @@ class OnionrConfig(unittest.TestCase):
self.assertEqual(conf['peers']['max_connect'], 1000)
self.assertEqual(conf['peers']['max_stored_peers'], 10000000)
self.assertEqual(conf['peers']['minimum_score'], -100)
self.assertEqual(conf['plugins']['disabled'], ['chat'])
self.assertEqual(conf['plugins']['disabled'], [])
self.assertEqual(conf['plugins']['enabled'], [])
self.assertEqual(conf['timers']['getBlocks'], 10)
self.assertEqual(conf['timers']['lookupBlocks'], 25)

View File

@ -8,10 +8,12 @@ TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
from utils import createdirs
createdirs.create_dirs()
from coredb import keydb
import onionrsetup as setup, keymanager, filepaths
from onionrutils import stringvalidators
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
setup.setup_config()
pub_key = keymanager.KeyManager().getPubkeyList()[0]
class KeyManagerTest(unittest.TestCase):

View File

@ -7,11 +7,14 @@ import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from utils import networkmerger
from coredb import keydb
import onionrsetup as setup
from utils import createdirs
createdirs.create_dirs()
setup.setup_config()
class NetworkMergerTest(unittest.TestCase):
def test_valid_merge(self):

View File

@ -8,12 +8,16 @@ from time import sleep
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from utils import networkmerger
from coredb import keydb
import onionrsetup as setup
from utils import createdirs
from onionrthreads import add_onionr_thread
createdirs.create_dirs()
setup.setup_config()
class OnionrThreadsTests(unittest.TestCase):

View File

@ -7,14 +7,17 @@ import json
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
import onionrexceptions
from onionrusers import onionrusers
from onionrusers import contactmanager
import onionrcrypto as crypto
from coredb import keydb
from utils import identifyhome, createdirs
createdirs.create_dirs()
from utils import identifyhome
class OnionrUserTests(unittest.TestCase):
'''
Tests both the onionrusers class and the contactmanager (which inherits it)

View File

@ -7,13 +7,15 @@ import base64
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from onionrpeers import peerprofiles
import onionrexceptions
from coredb import keydb
from utils import createdirs
from onionrutils import stringvalidators, epoch
TEST_PEER = '3n5wclq4w4pfkcfmjcpqrjluctpm2tzt7etfblavf42cntv6hrerkzyb.onion'
createdirs.create_dirs()
def rand_fake_adder_generator():
rand_bytes = os.urandom(35)

View File

@ -19,7 +19,7 @@ class TestRuntimeFile(unittest.TestCase):
def test_runtime_result(self):
self.assertTrue(os.path.exists(SUCCESS_FILE))
with open(SUCCESS_FILE, 'r') as result_file:
self.assertLess(math.floor(time.time()) - int(result_file.read()), 1800)
self.assertLess(math.floor(time.time()) - int(result_file.read()), 3800)
unittest.main()

View File

@ -12,11 +12,14 @@ import setupkvvars
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from utils import networkmerger
from coredb import keydb
import onionrsetup as setup
from utils import createdirs
createdirs.create_dirs()
setup.setup_config()
class SetupKVVarsTest(unittest.TestCase):

View File

@ -6,11 +6,13 @@ from time import sleep
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
os.environ["ONIONR_HOME"] = TEST_DIR
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
import config
import logger
from utils import createdirs
import onionrsetup as setup
from utils import createdirs
import onionrblocks
import filepaths
import onionrexceptions

View File

@ -6,12 +6,14 @@ import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from onionrblocks import time_insert
from onionrblocks import onionrblockapi
from onionrsetup import setup_config, setup_default_plugins
from utils import createdirs
createdirs.create_dirs()
setup_config()
setup_default_plugins()

View File

@ -7,6 +7,10 @@ TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
import hashlib
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from communicatorutils import uploadblocks
def hash_generator():

View File

@ -6,6 +6,10 @@ TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
import unittest
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
import vanityonionr
import niceware

View File

@ -5,6 +5,10 @@ import unittest, uuid, time, threading
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
os.environ["ONIONR_HOME"] = TEST_DIR
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from etc import waitforsetvar
def set_test_var_delay(obj, delay=0):

View File

@ -5,6 +5,10 @@ print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
sys.path.append(".")
sys.path.append("src/")
from utils import createdirs
createdirs.create_dirs()
from onionrcrypto import getourkeypair
getourkeypair.get_keypair()
from utils import reconstructhash