mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Refactor add_appointment cli code
This commit is contained in:
@@ -16,6 +16,7 @@ from pisa.watcher import Watcher
|
||||
from pisa.tools import bitcoin_cli
|
||||
from pisa.db_manager import DBManager
|
||||
from common.appointment import Appointment
|
||||
from common.tools import compute_locator
|
||||
|
||||
from bitcoind_mock.utils import sha256d
|
||||
from bitcoind_mock.transaction import TX
|
||||
@@ -103,7 +104,7 @@ def generate_dummy_appointment_data(real_height=True, start_time_offset=5, end_t
|
||||
encoding=serialization.Encoding.DER, format=serialization.PublicFormat.SubjectPublicKeyInfo
|
||||
)
|
||||
|
||||
locator = Watcher.compute_locator(dispute_txid)
|
||||
locator = compute_locator(dispute_txid)
|
||||
blob = Blob(dummy_appointment_data.get("tx"))
|
||||
|
||||
encrypted_blob = Cryptographer.encrypt(blob, dummy_appointment_data.get("tx_id"))
|
||||
|
||||
@@ -16,7 +16,7 @@ from test.pisa.unit.conftest import (
|
||||
)
|
||||
from pisa.conf import EXPIRY_DELTA, MAX_APPOINTMENTS
|
||||
|
||||
from common.tools import check_sha256_hex_format
|
||||
from common.tools import check_sha256_hex_format, compute_locator
|
||||
from common.cryptographer import Cryptographer
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ def txids():
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def locator_uuid_map(txids):
|
||||
return {Watcher.compute_locator(txid): uuid4().hex for txid in txids}
|
||||
return {compute_locator(txid): uuid4().hex for txid in txids}
|
||||
|
||||
|
||||
def create_appointments(n):
|
||||
@@ -219,7 +219,7 @@ def test_filter_valid_breaches(watcher):
|
||||
|
||||
dummy_appointment, _ = generate_dummy_appointment()
|
||||
dummy_appointment.encrypted_blob.data = encrypted_blob
|
||||
dummy_appointment.locator = Watcher.compute_locator(dispute_txid)
|
||||
dummy_appointment.locator = compute_locator(dispute_txid)
|
||||
uuid = uuid4().hex
|
||||
|
||||
appointments = {uuid: dummy_appointment}
|
||||
|
||||
Reference in New Issue
Block a user