added sneakernet auto importing
exportblocks now takes argument
This commit is contained in:
parent
160469f50f
commit
1bd0aa9419
17 changed files with 131 additions and 91 deletions
|
@ -15,6 +15,7 @@ from .osver import test_os_ver_endpoint
|
|||
from .clearnettor import test_clearnet_tor_request
|
||||
from .housekeeping import test_inserted_housekeeping
|
||||
from .lanservertest import test_lan_server
|
||||
from .sneakernettest import test_sneakernet_import
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -39,7 +40,8 @@ RUN_TESTS = [uicheck.check_ui,
|
|||
test_os_ver_endpoint,
|
||||
test_clearnet_tor_request,
|
||||
test_inserted_housekeeping,
|
||||
test_lan_server
|
||||
test_lan_server,
|
||||
sneakernettest.test_sneakernet_import
|
||||
]
|
||||
|
||||
SUCCESS_FILE = os.path.dirname(os.path.realpath(__file__)) + '/../../tests/runtime-result.txt'
|
||||
|
|
27
src/runtests/sneakernettest.py
Normal file
27
src/runtests/sneakernettest.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
import os
|
||||
from shutil import move
|
||||
|
||||
from onionrblocks import insert
|
||||
from onionrstorage import deleteBlock
|
||||
from onionrcommands.exportblocks import export_block
|
||||
from filepaths import export_location, block_data_location, data_nonce_file
|
||||
from etc.onionrvalues import BLOCK_EXPORT_FILE_EXT
|
||||
from onionrstorage.removeblock import remove_block
|
||||
from onionrstorage import deleteBlock
|
||||
from coredb.blockmetadb import get_block_list
|
||||
from utils import bettersleep
|
||||
from gevent import sleep
|
||||
|
||||
def test_sneakernet_import(test_manager):
|
||||
in_db = lambda b: b in get_block_list()
|
||||
bl = insert(os.urandom(10))
|
||||
assert in_db(bl)
|
||||
export_block(bl)
|
||||
assert os.path.exists(export_location + bl + BLOCK_EXPORT_FILE_EXT)
|
||||
remove_block(bl)
|
||||
deleteBlock(bl)
|
||||
assert not in_db(bl)
|
||||
os.remove(data_nonce_file)
|
||||
move(export_location + bl + BLOCK_EXPORT_FILE_EXT, block_data_location)
|
||||
sleep(1)
|
||||
assert in_db(bl)
|
Loading…
Add table
Add a link
Reference in a new issue