Fixes and tests updates

Updates tests so they run with the db_manager and fixes some bugs introduced in d7d42c9.
This commit is contained in:
Sergi Delgado Segura
2019-10-26 14:13:58 -07:00
parent ee1f024c51
commit f61474216c
9 changed files with 39 additions and 23 deletions

View File

@@ -4,7 +4,10 @@ import requests
from time import sleep
from threading import Thread
from pisa.conf import DB_PATH
from pisa.api import start_api
from pisa.watcher import Watcher
from pisa.db_manager import DBManager
from test.simulator.bitcoind_sim import run_simulator, HOST, PORT
@@ -20,7 +23,10 @@ def run_bitcoind():
@pytest.fixture(scope='session')
def run_api():
api_thread = Thread(target=start_api)
db_manager = DBManager(DB_PATH)
watcher = Watcher(db_manager)
api_thread = Thread(target=start_api, args=[watcher])
api_thread.daemon = True
api_thread.start()
@@ -33,6 +39,11 @@ def prng_seed():
random.seed(0)
@pytest.fixture(scope='session')
def db_manager():
return DBManager('test_db')
def get_random_value_hex(nbytes):
pseudo_random_value = random.getrandbits(8*nbytes)
prv_hex = '{:x}'.format(pseudo_random_value)