Skip to content

Commit

Permalink
fix: get_account now works if called a second time for the same accou…
Browse files Browse the repository at this point in the history
…nt name
  • Loading branch information
daniel-makerx committed Mar 23, 2023
1 parent 706df1a commit 513dd4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/algokit_utils/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def get_account(

if is_sandbox(client):
account = get_or_create_kmd_wallet_account(client, name, fund_with, kmd_client)
os.environ[mnemonic_key] = account.private_key
os.environ[mnemonic_key] = from_private_key(account.private_key) # type: ignore[no-untyped-call]
return account

raise Exception(f"Missing environment variable '{mnemonic_key}' when looking for account '{name}'")
11 changes: 11 additions & 0 deletions tests/test_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from algokit_utils import get_account
from algosdk.v2client.algod import AlgodClient
from conftest import get_unique_name


def test_account_can_be_called_twice(algod_client: AlgodClient) -> None:
account_name = get_unique_name()
account1 = get_account(algod_client, account_name)
account2 = get_account(algod_client, account_name)

assert account1 == account2

1 comment on commit 513dd4c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit_utils
   account.py77890%42–45, 78, 90, 115, 134
   app.py1561590%109, 143, 147–148, 223, 227, 233–241, 252–255
   application_client.py55812877%154, 169, 193, 198, 216, 218, 222, 235, 254, 257, 259, 261, 438, 482–484, 664–674, 733, 753, 801–802, 807, 822, 846–857, 872, 896–907, 920, 940–949, 953–954, 962–966, 972–996, 1017, 1048–1055, 1075, 1107, 1112, 1118, 1153–1159, 1163–1168, 1170, 1229, 1262, 1268, 1296–1301, 1317, 1322–1332, 1338, 1344, 1351–1354, 1389–1392, 1397–1402, 1406–1428, 1436, 1460
   application_specification.py892572%75, 78–87, 100, 108, 116, 158, 174, 196–205, 209
   logic_error.py35780%28, 60, 66–70
   network_clients.py47394%61, 64–65
TOTAL99918681% 

Tests Skipped Failures Errors Time
57 0 💤 0 ❌ 0 🔥 3m 53s ⏱️

Please sign in to comment.