Exemple #1
0
def doExport(bHash):
    createdirs.create_dirs()
    data = onionrstorage.getData(bHash)
    with open('%s/%s.dat' % (filepaths.export_location, bHash),
              'wb') as exportFile:
        exportFile.write(data)
        logger.info('Block exported as file', terminal=True)
Exemple #2
0
def _do_export(b_hash):
    createdirs.create_dirs()
    data = onionrstorage.getData(b_hash)
    with open(
            '%s/%s%s' %
        (filepaths.export_location, b_hash, BLOCK_EXPORT_FILE_EXT),
            'wb') as export:
        export.write(data)
        logger.info('Block exported as file', terminal=True)
Exemple #3
0
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("src/")
import unittest, uuid
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 onionrthreads import add_onionr_thread

setup.setup_config()


class OnionrThreadsTests(unittest.TestCase):
    def test_onionr_thread(self):
        l = []

        def _test_func(obj_list):
            obj_list.append(1)

        add_onionr_thread(_test_func, (l, ), 0.05, 0)
Exemple #4
0
def setup_test():
    TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(),
                                   os.path.basename(__file__)) + '/'
    print("Test directory:", TEST_DIR)
    os.environ["ONIONR_HOME"] = TEST_DIR
    createdirs.create_dirs()
Exemple #5
0
 def test_site_list(self):
     createdirs.create_dirs()
     setup.setup_config()
     testargs = ["onionr.py", "list-sites"]
     with patch.object(sys, 'argv', testargs):
         parser.register()