From 5663741ed4c5f972a5dce53e578960253928b83d Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Sun, 25 Apr 2021 14:54:54 +0000 Subject: [PATCH] cic-eth: Make failing tests pass again --- apps/cic-eth/cic_eth/ext/tx.py | 2 +- apps/cic-eth/cic_eth/queue/time.py | 1 + apps/cic-eth/requirements.txt | 6 +++--- apps/cic-eth/tests/filters/test_callback_filter.py | 2 ++ apps/cic-eth/tests/filters/test_tx_filter.py | 1 + apps/cic-eth/tests/fixtures_database.py | 3 +++ apps/cic-eth/tests/task/api/test_admin.py | 2 +- apps/cic-eth/tests/task/api/test_list.py | 2 +- 8 files changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/cic-eth/cic_eth/ext/tx.py b/apps/cic-eth/cic_eth/ext/tx.py index d635fd54..a5d59aa7 100644 --- a/apps/cic-eth/cic_eth/ext/tx.py +++ b/apps/cic-eth/cic_eth/ext/tx.py @@ -114,7 +114,7 @@ def list_tx_by_bloom(self, bloomspec, address, chain_spec_dict): # TODO: pass through registry to validate declarator entry of token #token = registry.by_address(tx['to'], sender_address=self.call_address) - token = ERC20Token(rpc, tx['to']) + token = ERC20Token(chain_spec, rpc, tx['to']) token_symbol = token.symbol token_decimals = token.decimals times = tx_times(tx['hash'], chain_spec) diff --git a/apps/cic-eth/cic_eth/queue/time.py b/apps/cic-eth/cic_eth/queue/time.py index b3c74ece..e60a4788 100644 --- a/apps/cic-eth/cic_eth/queue/time.py +++ b/apps/cic-eth/cic_eth/queue/time.py @@ -12,6 +12,7 @@ from chainqueue.error import NotLocalTxError # local imports from cic_eth.task import CriticalSQLAlchemyAndWeb3Task +from cic_eth.db.models.base import SessionBase celery_app = celery.current_app diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index c923ada2..ced81836 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,4 +1,4 @@ -cic-base==0.1.2b3 +cic-base==0.1.2b5 celery==4.4.7 crypto-dev-signer~=0.4.14b3 confini~=0.3.6rc3 @@ -15,10 +15,10 @@ semver==2.13.0 websocket-client==0.57.0 moolb~=0.1.1b2 eth-address-index~=0.1.1a9 -chainlib~=0.0.2a18 +chainlib~=0.0.2a20 hexathon~=0.0.1a7 chainsyncer[sql]~=0.0.2a2 -chainqueue~=0.0.1a7 +chainqueue~=0.0.2a2 pysha3==1.0.2 coincurve==15.0.0 sarafu-faucet==0.0.2a28 diff --git a/apps/cic-eth/tests/filters/test_callback_filter.py b/apps/cic-eth/tests/filters/test_callback_filter.py index 952ff157..0edca810 100644 --- a/apps/cic-eth/tests/filters/test_callback_filter.py +++ b/apps/cic-eth/tests/filters/test_callback_filter.py @@ -210,9 +210,11 @@ def test_callback_filter( def __init__(self): self.results = {} + self.queue = 'test' def call_back(self, transfer_type, result): self.results[transfer_type] = result + return self mock = CallbackMock() fltr.call_back = mock.call_back diff --git a/apps/cic-eth/tests/filters/test_tx_filter.py b/apps/cic-eth/tests/filters/test_tx_filter.py index 7515401e..bd706e5d 100644 --- a/apps/cic-eth/tests/filters/test_tx_filter.py +++ b/apps/cic-eth/tests/filters/test_tx_filter.py @@ -65,6 +65,7 @@ def test_tx( tx_hash_hex_orig = tx_hash_hex gas_oracle = OverrideGasOracle(price=1100000000, limit=21000) + c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle) (tx_hash_hex, tx_signed_raw_hex) = c.create(agent_roles['ALICE'], agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED) queue_create( default_chain_spec, diff --git a/apps/cic-eth/tests/fixtures_database.py b/apps/cic-eth/tests/fixtures_database.py index 604a87a4..6e43a852 100644 --- a/apps/cic-eth/tests/fixtures_database.py +++ b/apps/cic-eth/tests/fixtures_database.py @@ -53,6 +53,9 @@ def init_database( alembic.command.downgrade(ac, 'base') alembic.command.upgrade(ac, 'head') + session.execute('DELETE FROM lock') + session.commit() + yield session session.commit() session.close() diff --git a/apps/cic-eth/tests/task/api/test_admin.py b/apps/cic-eth/tests/task/api/test_admin.py index ca50f107..a37e94a9 100644 --- a/apps/cic-eth/tests/task/api/test_admin.py +++ b/apps/cic-eth/tests/task/api/test_admin.py @@ -273,7 +273,7 @@ def test_tx( eth_signer, agent_roles, contract_roles, - celery_worker, + celery_session_worker, ): nonce_oracle = RPCNonceOracle(agent_roles['ALICE'], eth_rpc) diff --git a/apps/cic-eth/tests/task/api/test_list.py b/apps/cic-eth/tests/task/api/test_list.py index 8f513ff4..0a452396 100644 --- a/apps/cic-eth/tests/task/api/test_list.py +++ b/apps/cic-eth/tests/task/api/test_list.py @@ -35,7 +35,7 @@ def test_list_tx( foo_token, register_tokens, init_eth_tester, - celery_worker, + celery_session_worker, ): tx_hashes = []