bumped network version and main version, lots of test work and some stability improvements

This commit is contained in:
Kevin Froman 2020-02-08 03:07:07 -06:00
parent e77d422fc2
commit 572e29f5d5
24 changed files with 243 additions and 33 deletions

View file

@ -0,0 +1,40 @@
from unittest.mock import patch
import sys, os
sys.path.append(".")
sys.path.append("src/")
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
from onionrcommands import parser
import onionrsetup as setup
from netcontroller.torcontrol import customtorrc
from utils import createdirs
from onionrsetup import setup_config, setup_default_plugins
from coredb import blockmetadb
from etc.onionrvalues import BLOCK_EXPORT_FILE_EXT
createdirs.create_dirs()
setup_config()
setup_default_plugins()
import config
from filepaths import export_location
class OnionrTests(unittest.TestCase):
def test_export(self):
testargs = ["onionr.py", "flowsend", "tests", "hello"]
with patch.object(sys, 'argv', testargs):
parser.register()
bl = blockmetadb.get_block_list()[0]
testargs = ["onionr.py", "export-block", bl]
with patch.object(sys, 'argv', testargs):
parser.register()
with open(export_location + '/' + bl + BLOCK_EXPORT_FILE_EXT, 'rb') as f:
if b'hello' not in f.read():
raise ValueError('No exported block')
unittest.main()