From 00b1a52c5dc7017b21fc88e5f5c959418f2c852f Mon Sep 17 00:00:00 2001 From: badrogger Date: Fri, 3 Nov 2023 12:42:43 +0000 Subject: [PATCH] Fix retry and sync_manager tests --- skale/transactions/result.py | 1 - tests/manager/sync_manager_test.py | 6 ++++-- tests/transaction_tools_test.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/skale/transactions/result.py b/skale/transactions/result.py index 330e9c4d..4bb65948 100644 --- a/skale/transactions/result.py +++ b/skale/transactions/result.py @@ -69,7 +69,6 @@ def tx_failed(self) -> bool: return not is_success_or_not_performed(self.receipt) def raise_for_status(self) -> None: - print(self.dry_run_result) if self.receipt is not None: if not is_success(self.receipt): error_msg = self.receipt['error'] diff --git a/tests/manager/sync_manager_test.py b/tests/manager/sync_manager_test.py index 9bca9ca5..f386717b 100644 --- a/tests/manager/sync_manager_test.py +++ b/tests/manager/sync_manager_test.py @@ -1,3 +1,5 @@ +from web3.exceptions import ContractLogicError + from skale.transactions.exceptions import DryRunRevertError import pytest @@ -50,9 +52,9 @@ def test_remove_range_bad_params(skale, sync_manager_permissions, block_in_secon def test_get_range_bad_params(skale, sync_manager_permissions, block_in_seconds): num = skale.sync_manager.get_ip_ranges_number() # TODO: Make dry run handle revert that has empty reason properly - with pytest.raises(DryRunRevertError): + with pytest.raises(ContractLogicError): r = skale.sync_manager.get_ip_range_by_index(num) - with pytest.raises(DryRunRevertError): + with pytest.raises(ContractLogicError): r = skale.sync_manager.get_ip_range_by_index(0) r = skale.sync_manager.get_ip_range_by_name('phantom') assert r.start_ip == '0.0.0.0' and r.end_ip == '0.0.0.0' diff --git a/tests/transaction_tools_test.py b/tests/transaction_tools_test.py index 71f4f2cc..551fdf03 100644 --- a/tests/transaction_tools_test.py +++ b/tests/transaction_tools_test.py @@ -60,7 +60,8 @@ def test_run_tx_with_retry_dry_run_failed(skale): dry_run_call_mock = mock.Mock( return_value={ 'status': 0, - 'error': 'Dry run failed' + 'message': 'Dry run test failure', + 'error': 'revert' } ) account = generate_account(skale.web3)