mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Refactors tests folder to separate different modules
Each module has a different folder and they do not share methods now. At some point they should be split in different repos
This commit is contained in:
0
test/apps/cli/__init__.py
Normal file
0
test/apps/cli/__init__.py
Normal file
0
test/apps/cli/unit/__init__.py
Normal file
0
test/apps/cli/unit/__init__.py
Normal file
7
test/apps/cli/unit/conftest.py
Normal file
7
test/apps/cli/unit/conftest.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import random
|
||||
|
||||
|
||||
def get_random_value_hex(nbytes):
|
||||
pseudo_random_value = random.getrandbits(8 * nbytes)
|
||||
prv_hex = "{:x}".format(pseudo_random_value)
|
||||
return prv_hex.zfill(2 * nbytes)
|
||||
@@ -7,7 +7,7 @@ from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.hazmat.primitives.asymmetric import ec
|
||||
|
||||
import apps.cli.pisa_cli as pisa_cli
|
||||
from test.unit.conftest import get_random_value_hex
|
||||
from test.apps.cli.unit.conftest import get_random_value_hex
|
||||
|
||||
# TODO: should find a way of doing without this
|
||||
from apps.cli.pisa_cli import build_appointment
|
||||
0
test/common/__init__.py
Normal file
0
test/common/__init__.py
Normal file
0
test/common/unit/__init__.py
Normal file
0
test/common/unit/__init__.py
Normal file
7
test/common/unit/conftest.py
Normal file
7
test/common/unit/conftest.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import random
|
||||
|
||||
|
||||
def get_random_value_hex(nbytes):
|
||||
pseudo_random_value = random.getrandbits(8 * nbytes)
|
||||
prv_hex = "{:x}".format(pseudo_random_value)
|
||||
return prv_hex.zfill(2 * nbytes)
|
||||
@@ -3,7 +3,7 @@ import binascii
|
||||
from apps.cli.blob import Blob
|
||||
from common.cryptographer import Cryptographer
|
||||
from pisa.encrypted_blob import EncryptedBlob
|
||||
from test.unit.conftest import get_random_value_hex
|
||||
from test.common.unit.conftest import get_random_value_hex
|
||||
|
||||
data = "6097cdf52309b1b2124efeed36bd34f46dc1c25ad23ac86f28380f746254f777"
|
||||
key = "b2e984a570f6f49bc38ace178e09147b0aa296cbb7c92eb01412f7e2d07b5659"
|
||||
0
test/pisa/__init__.py
Normal file
0
test/pisa/__init__.py
Normal file
0
test/pisa/unit/__init__.py
Normal file
0
test/pisa/unit/__init__.py
Normal file
@@ -11,7 +11,7 @@ from pisa.tools import bitcoin_cli
|
||||
from pisa import HOST, PORT, c_logger
|
||||
from pisa.conf import MAX_APPOINTMENTS
|
||||
|
||||
from test.unit.conftest import (
|
||||
from test.pisa.unit.conftest import (
|
||||
generate_block,
|
||||
generate_blocks,
|
||||
get_random_value_hex,
|
||||
@@ -5,7 +5,7 @@ from pisa import c_logger
|
||||
from pisa.appointment import Appointment
|
||||
from pisa.encrypted_blob import EncryptedBlob
|
||||
|
||||
from test.unit.conftest import get_random_value_hex
|
||||
from test.pisa.unit.conftest import get_random_value_hex
|
||||
|
||||
from common.constants import LOCATOR_LEN_BYTES
|
||||
|
||||
@@ -2,7 +2,7 @@ from binascii import unhexlify
|
||||
|
||||
from pisa import c_logger
|
||||
from apps.cli.blob import Blob
|
||||
from test.unit.conftest import get_random_value_hex
|
||||
from test.pisa.unit.conftest import get_random_value_hex
|
||||
|
||||
c_logger.disabled = True
|
||||
|
||||
@@ -2,7 +2,7 @@ import pytest
|
||||
|
||||
from pisa import c_logger
|
||||
from pisa.block_processor import BlockProcessor
|
||||
from test.unit.conftest import get_random_value_hex, generate_block, generate_blocks
|
||||
from test.pisa.unit.conftest import get_random_value_hex, generate_block, generate_blocks
|
||||
|
||||
c_logger.disabled = True
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from uuid import uuid4
|
||||
|
||||
from pisa.builder import Builder
|
||||
from test.unit.conftest import get_random_value_hex, generate_dummy_appointment, generate_dummy_tracker
|
||||
from test.pisa.unit.conftest import get_random_value_hex, generate_dummy_appointment, generate_dummy_tracker
|
||||
|
||||
|
||||
def test_build_appointments():
|
||||
@@ -4,7 +4,7 @@ from pisa import c_logger
|
||||
from pisa.carrier import Carrier
|
||||
from test.simulator.utils import sha256d
|
||||
from test.simulator.transaction import TX
|
||||
from test.unit.conftest import generate_blocks, generate_block, get_random_value_hex
|
||||
from test.pisa.unit.conftest import generate_blocks, get_random_value_hex
|
||||
from pisa.rpc_errors import RPC_VERIFY_ALREADY_IN_CHAIN, RPC_DESERIALIZATION_ERROR
|
||||
|
||||
c_logger.disabled = True
|
||||
@@ -7,7 +7,7 @@ from pisa.cleaner import Cleaner
|
||||
from pisa.appointment import Appointment
|
||||
from pisa.db_manager import WATCHER_PREFIX
|
||||
|
||||
from test.unit.conftest import get_random_value_hex
|
||||
from test.pisa.unit.conftest import get_random_value_hex
|
||||
|
||||
from common.constants import LOCATOR_LEN_BYTES, LOCATOR_LEN_HEX
|
||||
|
||||
@@ -9,7 +9,7 @@ from pisa.db_manager import WATCHER_LAST_BLOCK_KEY, RESPONDER_LAST_BLOCK_KEY, LO
|
||||
|
||||
from common.constants import LOCATOR_LEN_BYTES
|
||||
|
||||
from test.unit.conftest import get_random_value_hex, generate_dummy_appointment
|
||||
from test.pisa.unit.conftest import get_random_value_hex, generate_dummy_appointment
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@@ -1,6 +1,6 @@
|
||||
from pisa import c_logger
|
||||
from pisa.encrypted_blob import EncryptedBlob
|
||||
from test.unit.conftest import get_random_value_hex
|
||||
from test.pisa.unit.conftest import get_random_value_hex
|
||||
|
||||
c_logger.disabled = True
|
||||
|
||||
@@ -11,7 +11,7 @@ from pisa.appointment import Appointment
|
||||
from pisa.block_processor import BlockProcessor
|
||||
from pisa.conf import MIN_TO_SELF_DELAY
|
||||
|
||||
from test.unit.conftest import get_random_value_hex, generate_dummy_appointment_data, generate_keypair
|
||||
from test.pisa.unit.conftest import get_random_value_hex, generate_dummy_appointment_data, generate_keypair
|
||||
|
||||
from common.constants import LOCATOR_LEN_BYTES, LOCATOR_LEN_HEX
|
||||
from common.cryptographer import Cryptographer
|
||||
@@ -18,7 +18,7 @@ from common.tools import check_sha256_hex_format
|
||||
|
||||
from test.simulator.utils import sha256d
|
||||
from test.simulator.bitcoind_sim import TX
|
||||
from test.unit.conftest import generate_block, generate_blocks, get_random_value_hex
|
||||
from test.pisa.unit.conftest import generate_block, generate_blocks, get_random_value_hex
|
||||
|
||||
c_logger.disabled = True
|
||||
|
||||
@@ -8,7 +8,7 @@ from pisa import c_logger
|
||||
from pisa.watcher import Watcher
|
||||
from pisa.responder import Responder
|
||||
from pisa.tools import bitcoin_cli
|
||||
from test.unit.conftest import (
|
||||
from test.pisa.unit.conftest import (
|
||||
generate_block,
|
||||
generate_blocks,
|
||||
generate_dummy_appointment,
|
||||
@@ -4,7 +4,7 @@ from time import sleep
|
||||
from threading import Thread
|
||||
|
||||
from test.simulator.transaction import TX
|
||||
from test.unit.conftest import get_random_value_hex
|
||||
from test.pisa.unit import get_random_value_hex
|
||||
from test.simulator.bitcoind_sim import run_simulator
|
||||
from pisa.utils.auth_proxy import AuthServiceProxy, JSONRPCException
|
||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
||||
|
||||
Reference in New Issue
Block a user