-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Show network instead of provider in
ContractNotFoundError
(#2202)
- Loading branch information
Showing
5 changed files
with
38 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,31 @@ | ||
import pytest | ||
|
||
from ape.contracts.base import ContractCallHandler | ||
from ape.exceptions import ContractNotFoundError | ||
|
||
|
||
def test_struct_input( | ||
call_handler_with_struct_input, struct_input_for_call, output_from_struct_input_call | ||
): | ||
actual = call_handler_with_struct_input.encode_input(*struct_input_for_call) | ||
assert actual == output_from_struct_input_call | ||
|
||
|
||
def test_call_contract_not_found(mocker, method_abi_with_struct_input): | ||
contract = mocker.MagicMock() | ||
contract.is_contract = False | ||
method = method_abi_with_struct_input | ||
handler = ContractCallHandler(contract=contract, abis=[method]) | ||
expected = ".*Current network 'ethereum:local:test'.*" | ||
with pytest.raises(ContractNotFoundError, match=expected): | ||
handler() | ||
|
||
|
||
def test_transact_contract_not_found(mocker, owner, method_abi_with_struct_input): | ||
contract = mocker.MagicMock() | ||
contract.is_contract = False | ||
method = method_abi_with_struct_input | ||
handler = ContractCallHandler(contract=contract, abis=[method]) | ||
expected = ".*Current network 'ethereum:local:test'.*" | ||
with pytest.raises(ContractNotFoundError, match=expected): | ||
handler.transact(sender=owner) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters