fix tests
parent
30a4285b92
commit
adba4be099
|
@ -18,8 +18,8 @@ conf['general']['display_header'] = True
|
||||||
conf['general']['security_level'] = 0
|
conf['general']['security_level'] = 0
|
||||||
conf['general']['use_bootstrap_list'] = True
|
conf['general']['use_bootstrap_list'] = True
|
||||||
conf['onboarding']['done'] = False
|
conf['onboarding']['done'] = False
|
||||||
conf['general']['minimum_block_pow'] = 5
|
conf['general']['minimum_block_pow'] = 6
|
||||||
conf['general']['minimum_send_pow'] = 5
|
conf['general']['minimum_send_pow'] = 6
|
||||||
conf['log']['file']['remove_on_exit'] = True
|
conf['log']['file']['remove_on_exit'] = True
|
||||||
conf['transports']['lan'] = True
|
conf['transports']['lan'] = True
|
||||||
conf['transports']['tor'] = True
|
conf['transports']['tor'] = True
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
"hide_created_blocks": true,
|
"hide_created_blocks": true,
|
||||||
"insert_deniable_blocks": true,
|
"insert_deniable_blocks": true,
|
||||||
"max_block_age": 2678400,
|
"max_block_age": 2678400,
|
||||||
"minimum_block_pow": 5,
|
"minimum_block_pow": 6,
|
||||||
"minimum_send_pow": 5,
|
"minimum_send_pow": 6,
|
||||||
"public_key": "",
|
"public_key": "",
|
||||||
"random_bind_ip": true,
|
"random_bind_ip": true,
|
||||||
"security_level": 0,
|
"security_level": 0,
|
||||||
|
@ -45,8 +45,7 @@
|
||||||
"minimum_score": -100
|
"minimum_score": -100
|
||||||
},
|
},
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"disabled": [
|
"disabled": [],
|
||||||
],
|
|
||||||
"enabled": []
|
"enabled": []
|
||||||
},
|
},
|
||||||
"statistics": {
|
"statistics": {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1603867091
|
1606002757
|
|
@ -6,10 +6,14 @@ import unittest, uuid, sqlite3
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||||
from urllib.request import pathname2url
|
|
||||||
from coredb import keydb
|
|
||||||
from utils import createdirs
|
from utils import createdirs
|
||||||
createdirs.create_dirs()
|
createdirs.create_dirs()
|
||||||
|
from onionrcrypto import getourkeypair
|
||||||
|
getourkeypair.get_keypair()
|
||||||
|
from urllib.request import pathname2url
|
||||||
|
from coredb import keydb
|
||||||
|
|
||||||
|
|
||||||
class OnionrTests(unittest.TestCase):
|
class OnionrTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_address_add(self):
|
def test_address_add(self):
|
||||||
|
|
|
@ -5,10 +5,12 @@ import unittest, uuid, json
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||||
import onionrblocks
|
|
||||||
from utils import createdirs
|
from utils import createdirs
|
||||||
from utils import readstatic
|
|
||||||
createdirs.create_dirs()
|
createdirs.create_dirs()
|
||||||
|
from onionrcrypto import getourkeypair
|
||||||
|
getourkeypair.get_keypair()
|
||||||
|
from utils import readstatic
|
||||||
|
import onionrblocks
|
||||||
class OnionrConfig(unittest.TestCase):
|
class OnionrConfig(unittest.TestCase):
|
||||||
def test_default_file(self):
|
def test_default_file(self):
|
||||||
json.loads(readstatic.read_static('default_config.json'))
|
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_connect'], 1000)
|
||||||
self.assertEqual(conf['peers']['max_stored_peers'], 10000000)
|
self.assertEqual(conf['peers']['max_stored_peers'], 10000000)
|
||||||
self.assertEqual(conf['peers']['minimum_score'], -100)
|
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['plugins']['enabled'], [])
|
||||||
self.assertEqual(conf['timers']['getBlocks'], 10)
|
self.assertEqual(conf['timers']['getBlocks'], 10)
|
||||||
self.assertEqual(conf['timers']['lookupBlocks'], 25)
|
self.assertEqual(conf['timers']['lookupBlocks'], 25)
|
||||||
|
|
|
@ -8,10 +8,12 @@ TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||||
from utils import createdirs
|
from utils import createdirs
|
||||||
|
createdirs.create_dirs()
|
||||||
from coredb import keydb
|
from coredb import keydb
|
||||||
import onionrsetup as setup, keymanager, filepaths
|
import onionrsetup as setup, keymanager, filepaths
|
||||||
from onionrutils import stringvalidators
|
from onionrutils import stringvalidators
|
||||||
createdirs.create_dirs()
|
from onionrcrypto import getourkeypair
|
||||||
|
getourkeypair.get_keypair()
|
||||||
setup.setup_config()
|
setup.setup_config()
|
||||||
pub_key = keymanager.KeyManager().getPubkeyList()[0]
|
pub_key = keymanager.KeyManager().getPubkeyList()[0]
|
||||||
class KeyManagerTest(unittest.TestCase):
|
class KeyManagerTest(unittest.TestCase):
|
||||||
|
|
|
@ -7,11 +7,14 @@ import unittest, uuid
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = 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 utils import networkmerger
|
||||||
from coredb import keydb
|
from coredb import keydb
|
||||||
import onionrsetup as setup
|
import onionrsetup as setup
|
||||||
from utils import createdirs
|
|
||||||
createdirs.create_dirs()
|
|
||||||
setup.setup_config()
|
setup.setup_config()
|
||||||
class NetworkMergerTest(unittest.TestCase):
|
class NetworkMergerTest(unittest.TestCase):
|
||||||
def test_valid_merge(self):
|
def test_valid_merge(self):
|
||||||
|
|
|
@ -8,12 +8,16 @@ from time import sleep
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = 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 utils import networkmerger
|
||||||
from coredb import keydb
|
from coredb import keydb
|
||||||
import onionrsetup as setup
|
import onionrsetup as setup
|
||||||
from utils import createdirs
|
|
||||||
from onionrthreads import add_onionr_thread
|
from onionrthreads import add_onionr_thread
|
||||||
createdirs.create_dirs()
|
|
||||||
setup.setup_config()
|
setup.setup_config()
|
||||||
class OnionrThreadsTests(unittest.TestCase):
|
class OnionrThreadsTests(unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,17 @@ import json
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||||
|
from utils import createdirs
|
||||||
|
createdirs.create_dirs()
|
||||||
|
from onionrcrypto import getourkeypair
|
||||||
|
getourkeypair.get_keypair()
|
||||||
|
|
||||||
import onionrexceptions
|
import onionrexceptions
|
||||||
from onionrusers import onionrusers
|
from onionrusers import onionrusers
|
||||||
from onionrusers import contactmanager
|
from onionrusers import contactmanager
|
||||||
import onionrcrypto as crypto
|
import onionrcrypto as crypto
|
||||||
from coredb import keydb
|
from coredb import keydb
|
||||||
from utils import identifyhome, createdirs
|
from utils import identifyhome
|
||||||
createdirs.create_dirs()
|
|
||||||
class OnionrUserTests(unittest.TestCase):
|
class OnionrUserTests(unittest.TestCase):
|
||||||
'''
|
'''
|
||||||
Tests both the onionrusers class and the contactmanager (which inherits it)
|
Tests both the onionrusers class and the contactmanager (which inherits it)
|
||||||
|
|
|
@ -7,13 +7,15 @@ import base64
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = 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
|
from onionrpeers import peerprofiles
|
||||||
import onionrexceptions
|
import onionrexceptions
|
||||||
from coredb import keydb
|
from coredb import keydb
|
||||||
from utils import createdirs
|
|
||||||
from onionrutils import stringvalidators, epoch
|
from onionrutils import stringvalidators, epoch
|
||||||
TEST_PEER = '3n5wclq4w4pfkcfmjcpqrjluctpm2tzt7etfblavf42cntv6hrerkzyb.onion'
|
TEST_PEER = '3n5wclq4w4pfkcfmjcpqrjluctpm2tzt7etfblavf42cntv6hrerkzyb.onion'
|
||||||
createdirs.create_dirs()
|
|
||||||
|
|
||||||
def rand_fake_adder_generator():
|
def rand_fake_adder_generator():
|
||||||
rand_bytes = os.urandom(35)
|
rand_bytes = os.urandom(35)
|
||||||
|
|
|
@ -19,7 +19,7 @@ class TestRuntimeFile(unittest.TestCase):
|
||||||
def test_runtime_result(self):
|
def test_runtime_result(self):
|
||||||
self.assertTrue(os.path.exists(SUCCESS_FILE))
|
self.assertTrue(os.path.exists(SUCCESS_FILE))
|
||||||
with open(SUCCESS_FILE, 'r') as result_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()
|
unittest.main()
|
||||||
|
|
|
@ -12,11 +12,14 @@ import setupkvvars
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = 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 utils import networkmerger
|
||||||
from coredb import keydb
|
from coredb import keydb
|
||||||
import onionrsetup as setup
|
import onionrsetup as setup
|
||||||
from utils import createdirs
|
from utils import createdirs
|
||||||
createdirs.create_dirs()
|
|
||||||
setup.setup_config()
|
setup.setup_config()
|
||||||
|
|
||||||
class SetupKVVarsTest(unittest.TestCase):
|
class SetupKVVarsTest(unittest.TestCase):
|
||||||
|
|
|
@ -6,11 +6,13 @@ from time import sleep
|
||||||
|
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||||
|
from utils import createdirs
|
||||||
|
createdirs.create_dirs()
|
||||||
|
from onionrcrypto import getourkeypair
|
||||||
|
getourkeypair.get_keypair()
|
||||||
import config
|
import config
|
||||||
import logger
|
import logger
|
||||||
from utils import createdirs
|
|
||||||
import onionrsetup as setup
|
import onionrsetup as setup
|
||||||
from utils import createdirs
|
|
||||||
import onionrblocks
|
import onionrblocks
|
||||||
import filepaths
|
import filepaths
|
||||||
import onionrexceptions
|
import onionrexceptions
|
||||||
|
|
|
@ -6,12 +6,14 @@ import unittest, uuid
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = 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 time_insert
|
||||||
from onionrblocks import onionrblockapi
|
from onionrblocks import onionrblockapi
|
||||||
from onionrsetup import setup_config, setup_default_plugins
|
from onionrsetup import setup_config, setup_default_plugins
|
||||||
from utils import createdirs
|
|
||||||
|
|
||||||
createdirs.create_dirs()
|
|
||||||
setup_config()
|
setup_config()
|
||||||
setup_default_plugins()
|
setup_default_plugins()
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||||
import hashlib
|
import hashlib
|
||||||
|
from utils import createdirs
|
||||||
|
createdirs.create_dirs()
|
||||||
|
from onionrcrypto import getourkeypair
|
||||||
|
getourkeypair.get_keypair()
|
||||||
from communicatorutils import uploadblocks
|
from communicatorutils import uploadblocks
|
||||||
|
|
||||||
def hash_generator():
|
def hash_generator():
|
||||||
|
|
|
@ -6,6 +6,10 @@ TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
print("Test directory:", TEST_DIR)
|
print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||||
import unittest
|
import unittest
|
||||||
|
from utils import createdirs
|
||||||
|
createdirs.create_dirs()
|
||||||
|
from onionrcrypto import getourkeypair
|
||||||
|
getourkeypair.get_keypair()
|
||||||
import vanityonionr
|
import vanityonionr
|
||||||
|
|
||||||
import niceware
|
import niceware
|
||||||
|
|
|
@ -5,6 +5,10 @@ import unittest, uuid, time, threading
|
||||||
|
|
||||||
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||||
|
from utils import createdirs
|
||||||
|
createdirs.create_dirs()
|
||||||
|
from onionrcrypto import getourkeypair
|
||||||
|
getourkeypair.get_keypair()
|
||||||
from etc import waitforsetvar
|
from etc import waitforsetvar
|
||||||
|
|
||||||
def set_test_var_delay(obj, delay=0):
|
def set_test_var_delay(obj, delay=0):
|
||||||
|
|
|
@ -5,6 +5,10 @@ print("Test directory:", TEST_DIR)
|
||||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
sys.path.append("src/")
|
sys.path.append("src/")
|
||||||
|
from utils import createdirs
|
||||||
|
createdirs.create_dirs()
|
||||||
|
from onionrcrypto import getourkeypair
|
||||||
|
getourkeypair.get_keypair()
|
||||||
|
|
||||||
from utils import reconstructhash
|
from utils import reconstructhash
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue