Skip to content

Commit 700eb0a

Browse files
committed
Fix tests
1 parent f47be5b commit 700eb0a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

tests/e2e_tests/test_staking_sudo.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,17 @@ def test_staking(local_chain, wallet_setup):
396396
hyperparams = exec_command_alice(
397397
command="sudo",
398398
sub_command="get",
399-
extra_args=[
400-
"--chain",
401-
"ws://127.0.0.1:9945",
402-
"--netuid",
403-
netuid,
404-
],
399+
extra_args=["--chain", "ws://127.0.0.1:9945", "--netuid", netuid, "--json-out"],
405400
)
406401

407402
# Parse all hyperparameters and single out max_burn in TAO
408-
all_hyperparams = hyperparams.stdout.splitlines()
409-
max_burn_tao = all_hyperparams[22].split()[2].strip("\u200e")
403+
all_hyperparams = json.loads(hyperparams.stdout)
404+
max_burn_tao = next(
405+
filter(lambda x: x["hyperparameter"] == "max_burn", all_hyperparams)
406+
)["value"]
410407

411408
# Assert max_burn is 100 TAO from default
412-
assert Balance.from_tao(float(max_burn_tao)) == Balance.from_tao(100.0)
409+
assert Balance.from_rao(int(max_burn_tao)) == Balance.from_tao(100.0)
413410

414411
hyperparams_json = exec_command_alice(
415412
command="sudo",
@@ -468,7 +465,11 @@ def test_staking(local_chain, wallet_setup):
468465

469466
# Parse updated hyperparameters
470467
all_updated_hyperparams = updated_hyperparams.stdout.splitlines()
471-
updated_max_burn_tao = all_updated_hyperparams[22].split()[2].strip("\u200e")
468+
updated_max_burn_tao = (
469+
next(filter(lambda x: x[3:11] == "max_burn", all_updated_hyperparams))
470+
.split()[2]
471+
.strip("\u200e")
472+
)
472473

473474
# Assert max_burn is now 10 TAO
474475
assert Balance.from_tao(float(updated_max_burn_tao)) == Balance.from_tao(10)

0 commit comments

Comments
 (0)