From e9886dbb3e6f3bdfdf3570819f280b5ea35ab813 Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 14 Jul 2021 22:56:03 +0200 Subject: [PATCH] Execute address translate test as celery task --- .../test_task_address.py} | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) rename apps/cic-eth/tests/{unit/ext/test_address.py => task/test_task_address.py} (71%) diff --git a/apps/cic-eth/tests/unit/ext/test_address.py b/apps/cic-eth/tests/task/test_task_address.py similarity index 71% rename from apps/cic-eth/tests/unit/ext/test_address.py rename to apps/cic-eth/tests/task/test_task_address.py index b7d92b69..550cbac0 100644 --- a/apps/cic-eth/tests/unit/ext/test_address.py +++ b/apps/cic-eth/tests/task/test_task_address.py @@ -1,4 +1,5 @@ # external imports +import celery from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.tx import ( receipt, @@ -20,6 +21,7 @@ def test_translate( cic_registry, init_celery_tasks, register_lookups, + celery_worker, ): nonce_oracle = RPCNonceOracle(contract_roles['CONTRACT_DEPLOYER'], eth_rpc) @@ -46,6 +48,20 @@ def test_translate( 'recipient': agent_roles['BOB'], 'recipient_label': None, } - tx = translate_tx_addresses(tx, [contract_roles['CONTRACT_DEPLOYER']], default_chain_spec.asdict()) - assert tx['sender_label'] == 'alice' - assert tx['recipient_label'] == 'bob' + + #tx = translate_tx_addresses(tx, [contract_roles['CONTRACT_DEPLOYER']], default_chain_spec.asdict()) + s = celery.signature( + 'cic_eth.ext.address.translate_tx_addresses', + [ + tx, + [contract_roles['CONTRACT_DEPLOYER']], + default_chain_spec.asdict(), + ], + queue=None, + ) + t = s.apply_async() + r = t.get_leaf() + assert t.successful() + + assert r['sender_label'] == 'alice' + assert r['recipient_label'] == 'bob'