test_otx_status_log.py (1047B)
1 # standard imports 2 import unittest 3 4 # local imports 5 from chainqueue.db.models.otx import Otx 6 from chainqueue.sql.state import * 7 8 # test imports 9 from tests.chainqueue_base import TestOtxBase 10 11 12 class TestOtxState(TestOtxBase): 13 14 15 def setUp(self): 16 super(TestOtxState, self).setUp() 17 Otx.tracing = True 18 logg.debug('state trace') 19 20 21 def test_state_log(self): 22 set_ready(self.chain_spec, self.tx_hash, session=self.session) 23 set_reserved(self.chain_spec, self.tx_hash, session=self.session) 24 set_sent(self.chain_spec, self.tx_hash, session=self.session) 25 set_final(self.chain_spec, self.tx_hash, block=1042, session=self.session) 26 27 state_log = get_state_log(self.chain_spec, self.tx_hash) 28 self.assertEqual(state_log[0][1], StatusEnum.READYSEND) 29 self.assertEqual(state_log[1][1], StatusEnum.RESERVED) 30 self.assertEqual(state_log[2][1], StatusEnum.SENT) 31 self.assertEqual(state_log[3][1], StatusEnum.SUCCESS) 32 33 34 if __name__ == '__main__': 35 unittest.main()