diff --git a/counterparty-core/counterpartycore/pytest/units/messages/cancel_test.py b/counterparty-core/counterpartycore/pytest/units/messages/cancel_test.py index e8a6267c5..443ccc818 100644 --- a/counterparty-core/counterpartycore/pytest/units/messages/cancel_test.py +++ b/counterparty-core/counterpartycore/pytest/units/messages/cancel_test.py @@ -3,8 +3,8 @@ from counterpartycore.lib.messages import cancel -def test_compose(ledger_db, defaults): - open_order = ledger_db.execute( +def get_open_order(ledger_db): + return ledger_db.execute( """ SELECT * FROM (SELECT tx_hash, status, source, MAX(rowid) FROM orders GROUP BY tx_hash) @@ -12,6 +12,10 @@ def test_compose(ledger_db, defaults): """ ).fetchone() + +def test_compose(ledger_db, defaults): + open_order = get_open_order(ledger_db) + assert cancel.compose(ledger_db, open_order["source"], open_order["tx_hash"]) == ( open_order["source"], [], @@ -31,3 +35,35 @@ def test_compose(ledger_db, defaults): with pytest.raises(exceptions.ComposeError, match="offer not open"): cancel.compose(ledger_db, closed_bet["source"], closed_bet["tx_hash"]) + + +def test_parse_cancel_order(ledger_db, blockchain_mock, test_helpers, current_block_index): + open_order = get_open_order(ledger_db) + tx = blockchain_mock.dummy_tx(ledger_db, open_order["source"]) + message = b"\xe1\xba\xf7\xedl\x87\xc1\x99\xd3\xff\x8e\xb9\x00@\x03\xf0\xf6H\x1a\x1ePV+\x16