Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Dec 15, 2023
1 parent 5ffe9b1 commit 21cee08
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 37 deletions.
26 changes: 13 additions & 13 deletions tests/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,21 +639,21 @@ def struct_input_for_call(owner):


@pytest.fixture(scope="session")
def output_from_struct_input_call():
def output_from_struct_input_call(test_accounts):
# Expected when using `struct_input_for_call`.
addr = test_accounts[0].address.replace("0x", "")
return HexBytes(
"0x26e0a1960000000000000000000000001e59ce931b4cfea3fe4b875411e280e173cb7a9c"
"00000000000000000000000000000000000000000000000000000000000000800000000000"
"00000000000000000000000000000000000000000000000000012000000000000000000000"
"000000000000000000000000000000000000000001600000000000000000000000001e59ce"
"931b4cfea3fe4b875411e280e173cb7a9c736b697000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000060000000000000000000000000000000000000000000000000000000000000"
"0004736b697000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000004736b697000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000001736b69700000000000000000000000000000"
"0000000000000000000000000000"
f"0x26e0a196000000000000000000000000{addr}000000000000000000000000000000000"
f"0000000000000000000000000000080000000000000000000000000000000000000000000"
f"0000000000000000000120000000000000000000000000000000000000000000000000000"
f"0000000000160000000000000000000000000{addr}736b69700000000000000000000000"
f"0000000000000000000000000000000000000000000000000000000000000000000000000"
f"0000000000000000000000060000000000000000000000000000000000000000000000000"
f"0000000000000004736b69700000000000000000000000000000000000000000000000000"
f"0000000000000000000000000000000000000000000000000000000000000000000000473"
f"6b69700000000000000000000000000000000000000000000000000000000000000000000"
f"00000000000000000000000000000000000000000000000000001736b6970000000000000"
f"00000000000000000000000000000000000000000000"
)


Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_contract_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_contract_logs_range_by_address(
"toBlock": height_arg,
"topics": [
"0x7ff7bacc6cd661809ed1ddce28d4ad2c5b37779b61b9e3235f8262be529101a9",
"0x000000000000000000000000c89d42189f0450c2b2c3c61f58ec5d628176a1e7",
"0x00000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c8",
],
}
)
Expand Down
23 changes: 13 additions & 10 deletions tests/functional/test_contract_method_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ def test_encode_input_list_for_struct(chain, mocker, owner, method_abi_with_stru
params = [owner.address, b"foo", b"bar"]

actual = handler.encode_input(owner.address, params, b"", [])
acct = owner.address.replace("0x", "")
expected = HexBytes(
"0x26e0a1960000000000000000000000001e59ce931b4cfea3fe4b875411e280e173cb7a9c"
"00000000000000000000000000000000000000000000000000000000000000800000000000"
"00000000000000000000000000000000000000000000000000012000000000000000000000"
"000000000000000000000000000000000000000001400000000000000000000000001e59ce"
"931b4cfea3fe4b875411e280e173cb7a9c666f6f0000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000060000000000000000000000000000000000000000000000000000000000000"
"00036261720000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000"
"000000000000000000000000000000000000000000000000"
f"0x26e0a196000000000000000000000000{acct}000000000000000"
f"0000000000000000000000000000000000000000000000080000000"
f"0000000000000000000000000000000000000000000000000000000"
f"1200000000000000000000000000000000000000000000000000000"
f"000000000140000000000000000000000000{acct}666f6f0000000"
f"0000000000000000000000000000000000000000000000000000000"
f"0000000000000000000000000000000000000000000000000000000"
f"0006000000000000000000000000000000000000000000000000000"
f"0000000000000362617200000000000000000000000000000000000"
f"0000000000000000000000000000000000000000000000000000000"
f"0000000000000000000000000000000000000000000000000000000"
f"00000000000000000000000000000000000000000"
)
assert actual == expected
20 changes: 7 additions & 13 deletions tests/integration/cli/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,23 +330,17 @@ def invoke_generate():


@run_once
def test_list(ape_cli, runner, temp_keyfile):
# Check availability
assert temp_keyfile.is_file()
def test_list(ape_cli, runner, keyfile_account):
result = runner.invoke(ape_cli, ["accounts", "list"], catch_exceptions=False)
assert ALIAS in result.output

# NOTE: the un-checksummed version of this address is found in the temp_keyfile fixture.
expected_address = "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf"
assert expected_address in result.output
assert keyfile_account.alias in result.output
assert keyfile_account.address in result.output


@run_once
def test_list_all(ape_cli, runner, temp_keyfile):
# Check availability
assert temp_keyfile.is_file()
result = runner.invoke(ape_cli, ["accounts", "list", "--all"])
assert ALIAS in result.output
def test_list_all(ape_cli, runner, keyfile_account):
result = runner.invoke(ape_cli, ["accounts", "list", "--all"], catch_exceptions=False)
assert keyfile_account.alias in result.output
assert keyfile_account.address in result.output


@run_once
Expand Down

0 comments on commit 21cee08

Please sign in to comment.