mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
Moves start api to test_api since it was the only place where it's used
This commit is contained in:
@@ -8,9 +8,7 @@ from hashlib import sha256
|
||||
from binascii import unhexlify
|
||||
|
||||
from apps.cli.blob import Blob
|
||||
from pisa.api import start_api
|
||||
from pisa.responder import Job
|
||||
from pisa.watcher import Watcher
|
||||
from pisa.tools import bitcoin_cli
|
||||
from pisa.db_manager import DBManager
|
||||
from pisa.appointment import Appointment
|
||||
@@ -29,18 +27,6 @@ def run_bitcoind():
|
||||
sleep(0.1)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def run_api(db_manager):
|
||||
watcher = Watcher(db_manager)
|
||||
|
||||
api_thread = Thread(target=start_api, args=[watcher])
|
||||
api_thread.daemon = True
|
||||
api_thread.start()
|
||||
|
||||
# It takes a little bit of time to start the API (otherwise the requests are sent too early and they fail)
|
||||
sleep(0.1)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def prng_seed():
|
||||
random.seed(0)
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import json
|
||||
import pytest
|
||||
import requests
|
||||
from time import sleep
|
||||
from threading import Thread
|
||||
|
||||
from pisa import HOST, PORT, c_logger
|
||||
from pisa.api import start_api
|
||||
from pisa.watcher import Watcher
|
||||
from pisa.tools import bitcoin_cli
|
||||
from test.unit.conftest import generate_blocks, get_random_value_hex, generate_dummy_appointment_data
|
||||
from pisa import HOST, PORT, c_logger
|
||||
from pisa.conf import MAX_APPOINTMENTS
|
||||
from test.unit.conftest import generate_blocks, get_random_value_hex, generate_dummy_appointment_data
|
||||
|
||||
c_logger.disabled = True
|
||||
|
||||
@@ -16,6 +20,18 @@ appointments = []
|
||||
locator_dispute_tx_map = {}
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def run_api(db_manager):
|
||||
watcher = Watcher(db_manager)
|
||||
|
||||
api_thread = Thread(target=start_api, args=[watcher])
|
||||
api_thread.daemon = True
|
||||
api_thread.start()
|
||||
|
||||
# It takes a little bit of time to start the API (otherwise the requests are sent too early and they fail)
|
||||
sleep(0.1)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def new_appointment():
|
||||
appointment, dispute_tx = generate_dummy_appointment_data()
|
||||
|
||||
Reference in New Issue
Block a user