99import common .receipts as receipts
1010from common .exceptions import TowerResponseError
1111from common .tools import compute_locator
12- from common .appointment import Appointment
12+ from common .appointment import Appointment , AppointmentStatus
1313from common .cryptographer import Cryptographer
1414
1515from teos .cli .teos_cli import RPCClient
@@ -106,7 +106,7 @@ def test_appointment_life_cycle(run_bitcoind):
106106
107107 # Get the information from the tower to check that it matches
108108 appointment_info = get_appointment_info (locator )
109- assert appointment_info .get ("status" ) == "being_watched"
109+ assert appointment_info .get ("status" ) == AppointmentStatus . BEING_WATCHED
110110 assert appointment_info .get ("locator" ) == locator
111111 assert appointment_info .get ("appointment" ) == appointment .to_dict ()
112112
@@ -121,7 +121,7 @@ def test_appointment_life_cycle(run_bitcoind):
121121 # Trigger a breach and check again
122122 generate_block_with_transactions (commitment_tx )
123123 appointment_info = get_appointment_info (locator )
124- assert appointment_info .get ("status" ) == "dispute_responded"
124+ assert appointment_info .get ("status" ) == AppointmentStatus . DISPUTE_RESPONDED
125125 assert appointment_info .get ("locator" ) == locator
126126 appointments_in_watcher -= 1
127127 appointments_in_responder += 1
@@ -230,7 +230,7 @@ def test_appointment_malformed_penalty(run_bitcoind):
230230
231231 # Get the information from the tower to check that it matches
232232 appointment_info = get_appointment_info (locator )
233- assert appointment_info .get ("status" ) == "being_watched"
233+ assert appointment_info .get ("status" ) == AppointmentStatus . BEING_WATCHED
234234 assert appointment_info .get ("locator" ) == locator
235235 assert appointment_info .get ("appointment" ) == appointment .to_dict ()
236236
@@ -298,7 +298,7 @@ def test_two_identical_appointments(run_bitcoind):
298298 # The last appointment should have made it to the Responder
299299 appointment_info = get_appointment_info (locator )
300300
301- assert appointment_info .get ("status" ) == "dispute_responded"
301+ assert appointment_info .get ("status" ) == AppointmentStatus . DISPUTE_RESPONDED
302302 assert appointment_info .get ("appointment" ).get ("penalty_rawtx" ) == penalty_tx
303303
304304
@@ -325,9 +325,9 @@ def test_two_identical_appointments(run_bitcoind):
325325#
326326# # Check that we can get it from both users
327327# appointment_info = get_appointment_info(locator)
328- # assert appointment_info.get("status") == "being_watched"
328+ # assert appointment_info.get("status") == AppointmentStatus.BEING_WATCHED
329329# appointment_info = get_appointment_info(locator, sk=tmp_user_sk)
330- # assert appointment_info.get("status") == "being_watched"
330+ # assert appointment_info.get("status") == AppointmentStatus.BEING_WATCHED
331331#
332332# # Broadcast the commitment transaction and mine a block
333333# generate_block_with_transactions(commitment_tx)
@@ -344,7 +344,7 @@ def test_two_identical_appointments(run_bitcoind):
344344#
345345# appointment_info = appointment_info if appointment_info is None else appointment_dup_info
346346#
347- # assert appointment_info.get("status") == "dispute_responded"
347+ # assert appointment_info.get("status") == AppointmentStatus.DISPUTE_RESPONDED
348348# assert appointment_info.get("appointment").get("penalty_rawtx") == penalty_tx
349349
350350
@@ -385,7 +385,7 @@ def test_two_appointment_same_locator_different_penalty_different_users(run_bitc
385385 appointment_info = appointment2_info
386386 appointment1_data = appointment2_data
387387
388- assert appointment_info .get ("status" ) == "dispute_responded"
388+ assert appointment_info .get ("status" ) == AppointmentStatus . DISPUTE_RESPONDED
389389 assert appointment_info .get ("locator" ) == appointment1_data .get ("locator" )
390390 assert appointment_info .get ("appointment" ).get ("penalty_tx" ) == appointment1_data .get ("penalty_tx" )
391391
@@ -402,7 +402,7 @@ def test_add_appointment_trigger_on_cache(run_bitcoind):
402402 # Send the data to the tower and request it back. It should have gone straightaway to the Responder
403403 appointment = teos_client .create_appointment (appointment_data )
404404 add_appointment (appointment )
405- assert get_appointment_info (locator ).get ("status" ) == "dispute_responded"
405+ assert get_appointment_info (locator ).get ("status" ) == AppointmentStatus . DISPUTE_RESPONDED
406406
407407
408408def test_add_appointment_invalid_trigger_on_cache (run_bitcoind ):
@@ -483,15 +483,15 @@ def test_appointment_shutdown_teos_trigger_back_online(run_bitcoind):
483483 # Check that the appointment is still in the Watcher
484484 appointment_info = get_appointment_info (locator )
485485
486- assert appointment_info .get ("status" ) == "being_watched"
486+ assert appointment_info .get ("status" ) == AppointmentStatus . BEING_WATCHED
487487 assert appointment_info .get ("appointment" ) == appointment .to_dict ()
488488
489489 # Trigger appointment after restart
490490 generate_block_with_transactions (commitment_tx )
491491
492492 # The appointment should have been moved to the Responder
493493 appointment_info = get_appointment_info (locator )
494- assert appointment_info .get ("status" ) == "dispute_responded"
494+ assert appointment_info .get ("status" ) == AppointmentStatus . DISPUTE_RESPONDED
495495
496496
497497def test_appointment_shutdown_teos_trigger_while_offline (run_bitcoind ):
@@ -509,7 +509,7 @@ def test_appointment_shutdown_teos_trigger_while_offline(run_bitcoind):
509509
510510 # Check that the appointment is still in the Watcher
511511 appointment_info = get_appointment_info (locator )
512- assert appointment_info .get ("status" ) == "being_watched"
512+ assert appointment_info .get ("status" ) == AppointmentStatus . BEING_WATCHED
513513 assert appointment_info .get ("appointment" ) == appointment .to_dict ()
514514
515515 # Shutdown and trigger
@@ -525,4 +525,4 @@ def test_appointment_shutdown_teos_trigger_while_offline(run_bitcoind):
525525
526526 # The appointment should have been moved to the Responder
527527 appointment_info = get_appointment_info (locator )
528- assert appointment_info .get ("status" ) == "dispute_responded"
528+ assert appointment_info .get ("status" ) == AppointmentStatus . DISPUTE_RESPONDED
0 commit comments