From af13a3a6f61604d6bc800c4f6a9a6f2b80190189 Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Wed, 13 Apr 2022 16:19:59 +0200 Subject: [PATCH] fixed some command test cases Signed-off-by: Lorenz Herzberger --- planetmint/commands/planetmint.py | 5 +++-- planetmint/transactions/types/elections/election.py | 2 +- tests/commands/test_commands.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/planetmint/commands/planetmint.py b/planetmint/commands/planetmint.py index 9d09571..8b434d3 100644 --- a/planetmint/commands/planetmint.py +++ b/planetmint/commands/planetmint.py @@ -156,12 +156,13 @@ def run_election_new_upsert_validator(args, planet): :return: election_id or `False` in case of failure """ - new_validator = { + # TODO: check if this change reflects assets correctly + new_validator = [{ 'public_key': {'value': public_key_from_base64(args.public_key), 'type': 'ed25519-base16'}, 'power': args.power, 'node_id': args.node_id - } + }] return create_new_election(args.sk, planet, ValidatorElection, new_validator) diff --git a/planetmint/transactions/types/elections/election.py b/planetmint/transactions/types/elections/election.py index 8a6adef..e01d033 100644 --- a/planetmint/transactions/types/elections/election.py +++ b/planetmint/transactions/types/elections/election.py @@ -239,7 +239,7 @@ class Election(Transaction): planet.store_election(self.id, height, is_concluded) def show_election(self, planet): - data = self.asset['data'] + data = self.assets[0]['data'] if 'public_key' in data.keys(): data['public_key'] = public_key_to_base64(data['public_key']['value']) response = '' diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index a33bf82..7c9bee6 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -265,12 +265,12 @@ def test_run_recover(b, alice, bob): tx1 = Create.generate([alice.public_key], [([alice.public_key], 1)], - assets={'cycle': 'hero'}, + assets=[{'cycle': 'hero'}], metadata={'name': 'hohenheim'}) \ .sign([alice.private_key]) tx2 = Create.generate([bob.public_key], [([bob.public_key], 1)], - assets={'cycle': 'hero'}, + assets=[{'cycle': 'hero'}], metadata={'name': 'hohenheim'}) \ .sign([bob.private_key])