Uncomment tests

This commit is contained in:
nolash 2021-10-19 14:35:22 +02:00
parent 5e99a91d8b
commit 7ac6e6666c
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
1 changed files with 199 additions and 199 deletions

View File

@ -30,205 +30,205 @@ logg = logging.getLogger()
class TestTxQuery(TestTxBase): class TestTxQuery(TestTxBase):
# def test_get_tx(self): def test_get_tx(self):
# tx = get_tx(self.chain_spec, self.tx_hash) tx = get_tx(self.chain_spec, self.tx_hash)
# expected_keys = [ expected_keys = [
# 'otx_id', 'otx_id',
# 'status', 'status',
# 'signed_tx', 'signed_tx',
# 'nonce', 'nonce',
# ] ]
# for k in tx.keys(): for k in tx.keys():
# expected_keys.remove(k) expected_keys.remove(k)
#
# self.assertEqual(len(expected_keys), 0) self.assertEqual(len(expected_keys), 0)
#
#
# def test_nonce_tx(self): def test_nonce_tx(self):
#
# nonce_hashes = [self.tx_hash] nonce_hashes = [self.tx_hash]
# tx_hash = add_0x(os.urandom(32).hex()) tx_hash = add_0x(os.urandom(32).hex())
# signed_tx = add_0x(os.urandom(128).hex()) signed_tx = add_0x(os.urandom(128).hex())
# create( create(
# self.chain_spec, self.chain_spec,
# 42, 42,
# self.alice, self.alice,
# tx_hash, tx_hash,
# signed_tx, signed_tx,
# session=self.session, session=self.session,
# ) )
# txc = TxCache( txc = TxCache(
# tx_hash, tx_hash,
# self.alice, self.alice,
# self.bob, self.bob,
# self.foo_token, self.foo_token,
# self.bar_token, self.bar_token,
# self.from_value, self.from_value,
# self.to_value, self.to_value,
# session=self.session, session=self.session,
# ) )
# self.session.add(txc) self.session.add(txc)
# self.session.commit() self.session.commit()
#
# nonce_hashes.append(tx_hash) nonce_hashes.append(tx_hash)
#
# tx_hash = add_0x(os.urandom(32).hex()) tx_hash = add_0x(os.urandom(32).hex())
# signed_tx = add_0x(os.urandom(128).hex()) signed_tx = add_0x(os.urandom(128).hex())
# create( create(
# self.chain_spec, self.chain_spec,
# 41, 41,
# self.alice, self.alice,
# tx_hash, tx_hash,
# signed_tx, signed_tx,
# session=self.session, session=self.session,
# ) )
# txc = TxCache( txc = TxCache(
# tx_hash, tx_hash,
# self.alice, self.alice,
# self.bob, self.bob,
# self.foo_token, self.foo_token,
# self.bar_token, self.bar_token,
# self.from_value, self.from_value,
# self.to_value, self.to_value,
# session=self.session, session=self.session,
# ) )
# self.session.add(txc) self.session.add(txc)
#
# txs = get_nonce_tx_cache(self.chain_spec, 42, self.alice) txs = get_nonce_tx_cache(self.chain_spec, 42, self.alice)
# self.assertEqual(len(txs.keys()), 2) self.assertEqual(len(txs.keys()), 2)
#
# for h in nonce_hashes: for h in nonce_hashes:
# self.assertTrue(strip_0x(h) in txs) self.assertTrue(strip_0x(h) in txs)
#
#
# def test_paused_tx_cache(self): def test_paused_tx_cache(self):
# set_waitforgas(self.chain_spec, self.tx_hash) set_waitforgas(self.chain_spec, self.tx_hash)
#
# tx_hash = add_0x(os.urandom(32).hex()) tx_hash = add_0x(os.urandom(32).hex())
# signed_tx = add_0x(os.urandom(128).hex()) signed_tx = add_0x(os.urandom(128).hex())
# create( create(
# self.chain_spec, self.chain_spec,
# 43, 43,
# self.alice, self.alice,
# tx_hash, tx_hash,
# signed_tx, signed_tx,
# session=self.session, session=self.session,
# ) )
# txc = TxCache( txc = TxCache(
# tx_hash, tx_hash,
# self.alice, self.alice,
# self.bob, self.bob,
# self.foo_token, self.foo_token,
# self.bar_token, self.bar_token,
# self.from_value, self.from_value,
# self.to_value, self.to_value,
# session=self.session, session=self.session,
# ) )
# self.session.add(txc) self.session.add(txc)
# self.session.commit() self.session.commit()
#
# txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, sender=self.alice, session=self.session) txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, sender=self.alice, session=self.session)
# self.assertEqual(len(txs.keys()), 1) self.assertEqual(len(txs.keys()), 1)
#
# txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, session=self.session) txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, session=self.session)
# self.assertEqual(len(txs.keys()), 1) self.assertEqual(len(txs.keys()), 1)
#
# tx_hash = add_0x(os.urandom(32).hex()) tx_hash = add_0x(os.urandom(32).hex())
# signed_tx = add_0x(os.urandom(128).hex()) signed_tx = add_0x(os.urandom(128).hex())
# create( create(
# self.chain_spec, self.chain_spec,
# 42, 42,
# self.bob, self.bob,
# tx_hash, tx_hash,
# signed_tx, signed_tx,
# session=self.session, session=self.session,
# ) )
# txc = TxCache( txc = TxCache(
# tx_hash, tx_hash,
# self.bob, self.bob,
# self.alice, self.alice,
# self.bar_token, self.bar_token,
# self.foo_token, self.foo_token,
# self.to_value, self.to_value,
# self.from_value, self.from_value,
# session=self.session, session=self.session,
# ) )
# self.session.add(txc) self.session.add(txc)
# self.session.commit() self.session.commit()
#
# txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, session=self.session) txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, session=self.session)
# self.assertEqual(len(txs.keys()), 1) self.assertEqual(len(txs.keys()), 1)
#
# set_waitforgas(self.chain_spec, tx_hash) set_waitforgas(self.chain_spec, tx_hash)
# self.session.commit() self.session.commit()
#
# txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, session=self.session) txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, session=self.session)
# self.assertEqual(len(txs.keys()), 2) self.assertEqual(len(txs.keys()), 2)
#
# txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, sender=self.bob, session=self.session) txs = get_paused_tx_cache(self.chain_spec, status=StatusBits.GAS_ISSUES, sender=self.bob, session=self.session)
# self.assertEqual(len(txs.keys()), 1) self.assertEqual(len(txs.keys()), 1)
#
#
# def test_count(self): def test_count(self):
# for i in range(3): for i in range(3):
# tx_hash = add_0x(os.urandom(32).hex()) tx_hash = add_0x(os.urandom(32).hex())
# signed_tx = add_0x(os.urandom(128).hex()) signed_tx = add_0x(os.urandom(128).hex())
# create( create(
# self.chain_spec, self.chain_spec,
# i, i,
# self.alice, self.alice,
# tx_hash, tx_hash,
# signed_tx, signed_tx,
# session=self.session, session=self.session,
# ) )
# txc = TxCache( txc = TxCache(
# tx_hash, tx_hash,
# self.alice, self.alice,
# self.bob, self.bob,
# self.foo_token, self.foo_token,
# self.bar_token, self.bar_token,
# self.from_value, self.from_value,
# self.to_value, self.to_value,
# session=self.session, session=self.session,
# ) )
# self.session.add(txc) self.session.add(txc)
# set_ready(self.chain_spec, tx_hash, session=self.session) set_ready(self.chain_spec, tx_hash, session=self.session)
# set_reserved(self.chain_spec, tx_hash, session=self.session) set_reserved(self.chain_spec, tx_hash, session=self.session)
# if i > 0: if i > 0:
# set_sent(self.chain_spec, tx_hash, session=self.session) set_sent(self.chain_spec, tx_hash, session=self.session)
# if i == 2: if i == 2:
# set_final(self.chain_spec, tx_hash, session=self.session) set_final(self.chain_spec, tx_hash, session=self.session)
#
# tx_hash = add_0x(os.urandom(32).hex()) tx_hash = add_0x(os.urandom(32).hex())
# signed_tx = add_0x(os.urandom(128).hex()) signed_tx = add_0x(os.urandom(128).hex())
# create( create(
# self.chain_spec, self.chain_spec,
# i, i,
# self.bob, self.bob,
# tx_hash, tx_hash,
# signed_tx, signed_tx,
# session=self.session, session=self.session,
# ) )
# txc = TxCache( txc = TxCache(
# tx_hash, tx_hash,
# self.bob, self.bob,
# self.carol, self.carol,
# self.foo_token, self.foo_token,
# self.bar_token, self.bar_token,
# self.from_value, self.from_value,
# self.to_value, self.to_value,
# session=self.session, session=self.session,
# ) )
#
# self.session.add(txc) self.session.add(txc)
# set_ready(self.chain_spec, tx_hash, session=self.session) set_ready(self.chain_spec, tx_hash, session=self.session)
# set_reserved(self.chain_spec, tx_hash, session=self.session) set_reserved(self.chain_spec, tx_hash, session=self.session)
# set_sent(self.chain_spec, tx_hash, session=self.session) set_sent(self.chain_spec, tx_hash, session=self.session)
# self.session.commit() self.session.commit()
#
# self.assertEqual(count_tx(self.chain_spec, status=StatusBits.IN_NETWORK | StatusBits.FINAL, status_target=StatusBits.IN_NETWORK), 2) self.assertEqual(count_tx(self.chain_spec, status=StatusBits.IN_NETWORK | StatusBits.FINAL, status_target=StatusBits.IN_NETWORK), 2)
# self.assertEqual(count_tx(self.chain_spec, address=self.alice, status=StatusBits.IN_NETWORK | StatusBits.FINAL, status_target=StatusBits.IN_NETWORK), 1) self.assertEqual(count_tx(self.chain_spec, address=self.alice, status=StatusBits.IN_NETWORK | StatusBits.FINAL, status_target=StatusBits.IN_NETWORK), 1)
#
def test_account_tx(self): def test_account_tx(self):