Skip to content

Commit

Permalink
tests: fix tests to work w/ cli
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Feb 25, 2025
1 parent 6f62389 commit 03cfdde
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
13 changes: 7 additions & 6 deletions tests/integration/test_pending_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def test_propose(runner, cli, safe_account, receiver, chain):
cmd = (
"pending",
"propose",
"--safe",
safe_account.alias,
"--to",
receiver.address,
"--value",
Expand All @@ -25,13 +27,8 @@ def test_propose(runner, cli, safe_account, receiver, chain):
# so it prompts the user.
sender_input = f"{safe_account.alias}\n"

result = runner.invoke(cli, cmd, catch_exceptions=False, input=sender_input)
result = runner.invoke(cli, cmd, input=sender_input)
assert result.exit_code == 0
assert "Proposed transaction" in result.output
safe_tx_hash = result.output.split("Proposed transaction '")[-1].split("'")[0].strip()

# Verify the transaction is in the service.
assert safe_tx_hash in safe_account.client.transactions

# The nonce is the same because we did not execute.
assert safe_account.next_nonce == nonce_at_start
Expand All @@ -45,6 +42,8 @@ def test_propose_with_sender(runner, cli, safe_account, receiver, chain, foundry
cmd = (
"pending",
"propose",
"--safe",
safe_account.alias,
"--to",
receiver.address,
"--value",
Expand All @@ -69,6 +68,8 @@ def test_propose_with_execute(runner, cli, safe_account, receiver, chain):
cmd = (
"pending",
"propose",
"--safe",
safe_account.alias,
"--to",
receiver.address,
"--value",
Expand Down
14 changes: 11 additions & 3 deletions tests/integration/test_safe_mgmt_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,25 @@ def test_add_safe(runner, cli, safe, chain, safe_container):
input="y\n",
)
assert result.exit_code == 0, result.output
assert "SUCCESS" in result.output, result.output

result = runner.invoke(cli, "list")
assert safe.address in result.output, result.output
safe_container.delete_account(safe.alias)


def test_remove_safe(runner, cli, safe_account):
safe_address = safe_account.address
result = runner.invoke(cli, ("remove", safe_account.alias), catch_exceptions=False, input="y\n")
assert result.exit_code == 0, result.output
assert "SUCCESS" in result.output, result.output

result = runner.invoke(cli, "list")
assert safe_address not in result.output, result.output


def test_remove_safe_skip_confirmation(runner, cli, safe_account):
safe_address = safe_account.address
result = runner.invoke(cli, ("remove", safe_account.alias, "--yes"), catch_exceptions=False)
assert result.exit_code == 0, result.output
assert "SUCCESS" in result.output, result.output

result = runner.invoke(cli, "list")
assert safe_address not in result.output, result.output

0 comments on commit 03cfdde

Please sign in to comment.