Adds dummy appointment and job methods to conftest and includes triggered param to test_api

This commit is contained in:
Sergi Delgado Segura
2019-11-05 19:11:58 +00:00
parent 6644ad5bd1
commit a6b1f96aaf
2 changed files with 31 additions and 3 deletions

View File

@@ -7,8 +7,10 @@ from threading import Thread
from pisa.conf import DB_PATH
from pisa.api import start_api
from pisa.responder import Job
from pisa.watcher import Watcher
from pisa.db_manager import DBManager
from pisa.appointment import Appointment
from test.simulator.bitcoind_sim import run_simulator, HOST, PORT
@@ -65,3 +67,28 @@ def generate_blocks(n):
generate_block()
def generate_dummy_appointment():
locator = get_random_value_hex(32)
encrypted_blob = get_random_value_hex(250)
start_time = 100
end_time = 120
dispute_delta = 20
cipher = "AES-GCM-128"
hash_function = "SHA256"
appointment_data = dict(locator=locator, start_time=start_time, end_time=end_time, dispute_delta=dispute_delta,
encrypted_blob=encrypted_blob, cipher=cipher, hash_function=hash_function, triggered=False)
return Appointment.from_dict(appointment_data)
def generate_dummy_job():
dispute_txid = get_random_value_hex(32)
justice_txid = get_random_value_hex(32)
justice_rawtx = get_random_value_hex(100)
job_data = dict(dispute_txid=dispute_txid, justice_txid=justice_txid, justice_rawtx=justice_rawtx,
appointment_end=100)
return Job.from_dict(job_data)