Skip to content

Commit

Permalink
fix: undo and add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Jan 17, 2024
1 parent 668d5ed commit 9a3c7b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 0 additions & 1 deletion ape_foundry/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ def build_command(self) -> List[str]:
f"{self.settings.base_fee}",
"--gas-price",
f"{self.settings.gas_price}",
"--disable-block-gas-limit",
]

if not self.settings.auto_mine:
Expand Down
18 changes: 12 additions & 6 deletions tests/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,18 @@ def test_snapshot_and_revert(connected_provider):
assert block_1.hash == block_3.hash


@pytest.mark.parametrize("tx_type", (None, 0, 1, 2))
def test_unlock_account(connected_provider, contract_a, accounts, tx_type):
@pytest.mark.parametrize("tx_kwargs", [
{}, # NO KWARGS CASE: Should default to type 2
{"type": 0},
{"type": 0, "gas_price": 0},
# TODO: Uncomment after ape 0.7.5 is released
# {"type": 1},
# {"type": 1, "gas_price": 0},
{"type": 2},
{"type": 2, "max_priority_fee": 0},
{"type": 2, "base_fee": 0, "max_priority_fee": 0},
])
def test_unlock_account(connected_provider, contract_a, accounts, tx_kwargs):
actual = connected_provider.unlock_account(TEST_WALLET_ADDRESS)
assert actual is True

Expand All @@ -110,10 +120,6 @@ def test_unlock_account(connected_provider, contract_a, accounts, tx_type):
# Ensure can transact.
# NOTE: Using type 0 to avoid needing to set a balance.
acct.balance += 1_000_000_000_000_000_000

# Also testing the case where `type` is omitted completely.
tx_kwargs = {"type": tx_type} if tx_type is not None else {}

receipt_0 = contract_a.methodWithoutArguments(sender=acct, **tx_kwargs)
assert not receipt_0.failed

Expand Down

0 comments on commit 9a3c7b3

Please sign in to comment.