mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Applies fixes after PR review
This commit is contained in:
@@ -28,13 +28,13 @@ class Appointment:
|
||||
hash_function = appointment_data.get("hash_function")
|
||||
triggered = appointment_data.get("triggered")
|
||||
|
||||
if all(v is not None for v in [locator, start_time, end_time, dispute_delta, encrypted_blob_data, cipher,
|
||||
hash_function, triggered]):
|
||||
appointment = cls(locator, start_time, end_time, dispute_delta, encrypted_blob_data, cipher,
|
||||
hash_function, triggered)
|
||||
if any(v is None for v in [locator, start_time, end_time, dispute_delta, encrypted_blob_data, cipher,
|
||||
hash_function, triggered]):
|
||||
raise ValueError("Wrong appointment data, some fields are missing")
|
||||
|
||||
else:
|
||||
raise ValueError("Wrong appointment data, some fields are missing")
|
||||
appointment = cls(locator, start_time, end_time, dispute_delta, encrypted_blob_data, cipher, hash_function,
|
||||
triggered)
|
||||
|
||||
return appointment
|
||||
|
||||
|
||||
@@ -2,11 +2,15 @@ import json
|
||||
import plyvel
|
||||
|
||||
from pisa.logger import Logger
|
||||
from pisa.conf import WATCHER_PREFIX, RESPONDER_PREFIX, WATCHER_LAST_BLOCK_KEY, RESPONDER_LAST_BLOCK_KEY, \
|
||||
LOCATOR_MAP_PREFIX
|
||||
|
||||
logger = Logger("DBManager")
|
||||
|
||||
WATCHER_PREFIX = "w"
|
||||
WATCHER_LAST_BLOCK_KEY = "bw"
|
||||
RESPONDER_PREFIX = "r"
|
||||
RESPONDER_LAST_BLOCK_KEY = "br"
|
||||
LOCATOR_MAP_PREFIX = 'm'
|
||||
|
||||
|
||||
class DBManager:
|
||||
def __init__(self, db_path):
|
||||
|
||||
@@ -35,11 +35,11 @@ class Job:
|
||||
justice_rawtx = job_data.get("justice_rawtx")
|
||||
appointment_end = job_data.get("appointment_end")
|
||||
|
||||
if all(v is not None for v in [dispute_txid, justice_txid, justice_rawtx, appointment_end]):
|
||||
job = cls(dispute_txid, justice_txid, justice_rawtx, appointment_end)
|
||||
if any(v is None for v in [dispute_txid, justice_txid, justice_rawtx, appointment_end]):
|
||||
raise ValueError("Wrong job data, some fields are missing")
|
||||
|
||||
else:
|
||||
raise ValueError("Wrong job data, some fields are missing")
|
||||
job = cls(dispute_txid, justice_txid, justice_rawtx, appointment_end)
|
||||
|
||||
return job
|
||||
|
||||
|
||||
@@ -29,8 +29,3 @@ SUPPORTED_CIPHERS = ["AES-GCM-128"]
|
||||
|
||||
# LEVELDB
|
||||
DB_PATH = "appointments"
|
||||
WATCHER_PREFIX = "w"
|
||||
WATCHER_LAST_BLOCK_KEY = "bw"
|
||||
RESPONDER_PREFIX = "r"
|
||||
RESPONDER_LAST_BLOCK_KEY = "br"
|
||||
LOCATOR_MAP_PREFIX = 'm'
|
||||
|
||||
@@ -6,7 +6,7 @@ from uuid import uuid4
|
||||
|
||||
from pisa.db_manager import DBManager
|
||||
from test.unit.conftest import get_random_value_hex, generate_dummy_appointment
|
||||
from pisa.conf import WATCHER_LAST_BLOCK_KEY, RESPONDER_LAST_BLOCK_KEY, LOCATOR_MAP_PREFIX
|
||||
from pisa.db_manager import WATCHER_LAST_BLOCK_KEY, RESPONDER_LAST_BLOCK_KEY, LOCATOR_MAP_PREFIX
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
@@ -255,25 +255,3 @@ def test_store_load_last_block_hash_responder(db_manager):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user