Skip to content

Commit

Permalink
Add async test
Browse files Browse the repository at this point in the history
  • Loading branch information
reedsa committed Nov 10, 2023
1 parent 3f55ddf commit 70e9cc1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
24 changes: 14 additions & 10 deletions tests/core/contracts/conftest.py
Expand Up @@ -496,6 +496,20 @@ async def async_math_contract(
)


@pytest.fixture
def async_function_name_tester_contract_factory(async_w3):
return async_w3.eth.contract(**FUNCTION_NAME_TESTER_CONTRACT_DATA)


@pytest_asyncio.fixture
async def async_function_name_tester_contract(
async_w3, async_function_name_tester_contract_factory, w3_func
):
return await async_deploy(
async_w3, async_function_name_tester_contract_factory, w3_func
)


@pytest.fixture
def async_simple_constructor_contract_factory(async_w3):
return async_w3.eth.contract(**SIMPLE_CONSTRUCTOR_CONTRACT_DATA)
Expand Down Expand Up @@ -617,16 +631,6 @@ async def async_fallback_function_contract(async_w3, address_conversion_func):
)


@pytest_asyncio.fixture
async def async_function_name_tester_contract(async_w3, address_conversion_func):
async_function_name_override_contract_factory = async_w3.eth.contract(
**FUNCTION_NAME_TESTER_CONTRACT_DATA
)
return await async_deploy(
async_w3, async_function_name_override_contract_factory, address_conversion_func
)


@pytest_asyncio.fixture
async def async_no_receive_function_contract(async_w3, address_conversion_func):
async_no_receive_function_contract_factory = async_w3.eth.contract(
Expand Down
8 changes: 8 additions & 0 deletions tests/core/contracts/test_contract_call_interface.py
Expand Up @@ -1295,6 +1295,14 @@ async def test_async_saved_method_call_with_multiple_arguments(
assert result == 16


@pytest.mark.asyncio
async def test_async_call_get_w3_value(async_function_name_tester_contract, async_call):
result = await async_call(
contract=async_function_name_tester_contract, contract_function="w3"
)
assert result is True


@pytest.mark.asyncio
async def test_async_call_get_string_value(async_string_contract, async_call):
result = await async_call(
Expand Down

0 comments on commit 70e9cc1

Please sign in to comment.