safe-transaction-service icon indicating copy to clipboard operation
safe-transaction-service copied to clipboard

Fix test `test_process_aa_transaction`

Open falvaradorodriguez opened this issue 11 months ago • 0 comments

Describe the bug When executing the run_tests.sh command, the following error occurs:

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― TestAaProcessorService.test_process_aa_transaction ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

self = <safe_transaction_service.account_abstraction.tests.services.test_aa_processor_service.TestAaProcessorService testMethod=test_process_aa_transaction>, get_chain_id_mock = <MagicMock name='get_chain_id' spec='_lru_cache_wrapper' id='4710158592'>

    @mock.patch.object(
        EthereumClient,
        "get_chain_id",
        autospec=True,
        return_value=aa_chain_id,  # Needed for hashes to match
    )
    def test_process_aa_transaction(self, get_chain_id_mock: MagicMock):
        ethereum_tx = history_factories.EthereumTxFactory(
            logs=[clean_receipt_log(log) for log in aa_tx_receipt_mock["logs"]]
        )
        self.aa_processor_service.process_aa_transaction(aa_safe_address, ethereum_tx)
    
        self.assertEqual(
>           UserOperationModel.objects.get().hash, aa_expected_user_operation_hash.hex()
        )

safe_transaction_service/account_abstraction/tests/services/test_aa_processor_service.py:51: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
venv/lib/python3.12/site-packages/django/db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <QuerySet []>, args = (), kwargs = {}, clone = <QuerySet []>, limit = 21, num = 0

    def get(self, *args, **kwargs):
        """
        Perform the query and return a single object matching the given
        keyword arguments.
        """
        if self.query.combinator and (args or kwargs):
            raise NotSupportedError(
                "Calling QuerySet.get(...) with filters after %s() is not "
                "supported." % self.query.combinator
            )
        clone = self._chain() if self.query.combinator else self.filter(*args, **kwargs)
        if self.query.can_filter() and not self.query.distinct_fields:
            clone = clone.order_by()
        limit = None
        if (
            not clone.query.select_for_update
            or connections[clone.db].features.supports_select_for_update_with_limit
        ):
            limit = MAX_GET_RESULTS
            clone.query.set_limits(high=limit)
        num = len(clone)
        if num == 1:
            return clone._result_cache[0]
        if not num:
>           raise self.model.DoesNotExist(
                "%s matching query does not exist." % self.model._meta.object_name
            )
E           safe_transaction_service.account_abstraction.models.UserOperation.DoesNotExist: UserOperation matching query does not exist.

venv/lib/python3.12/site-packages/django/db/models/query.py:649: DoesNotExist
----------------------------------------------------------------------------------------------------------------------------------------------- Captured log setup ------------------------------------------------------------------------------------------------------------------------------------------------
WARNING  safe_transaction_service.account_abstraction.services.aa_processor_service:aa_processor_service.py:55 Ethereum 4337 bundler client was not configured
------------------------------------------------------------------------------------------------------------------------------------------------ Captured log call ------------------------------------------------------------------------------------------------------------------------------------------------
WARNING  safe_transaction_service.account_abstraction.services.aa_processor_service:aa_processor_service.py:55 Ethereum 4337 bundler client was not configured
DEBUG    safe_transaction_service.account_abstraction.services.aa_processor_service:aa_processor_service.py:343 Detected 4337 User Operation but bundler client was not configured

 safe_transaction_service/account_abstraction/tests/services/test_aa_processor_service.py ⨯                                                                                                                                                                                                           0%           

falvaradorodriguez avatar Apr 02 '24 07:04 falvaradorodriguez