From 7c647c4c00deb1c216badd5854bdeba84c2c67a2 Mon Sep 17 00:00:00 2001 From: Levente Pap Date: Mon, 18 Nov 2019 16:20:27 +0100 Subject: [PATCH] Fine-tune is_promotable response dictionary Make the response dict consistent with check_consistency. Delete 'info' key in response if 'promotable' is True. --- iota/api.py | 2 ++ iota/commands/extended/is_promotable.py | 3 ++- test/commands/extended/is_promotable_test.py | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/iota/api.py b/iota/api.py index 47dcb7b8..9b12bf79 100644 --- a/iota/api.py +++ b/iota/api.py @@ -1357,6 +1357,8 @@ def is_promotable( 'info': Optional(List[Text]) If `promotable` is ``False``, this contains info about what went wrong. + Note that when 'promotable' is ``True``, 'info' does not + exist. } diff --git a/iota/commands/extended/is_promotable.py b/iota/commands/extended/is_promotable.py index 11f4bb83..cda97691 100644 --- a/iota/commands/extended/is_promotable.py +++ b/iota/commands/extended/is_promotable.py @@ -93,8 +93,9 @@ def _execute(self, request): response['promotable'] = response['promotable'] and is_within # If there are no problems, we don't need 'info' field + # Delete info field to make it consistent with check_consistency repsonse. if response['promotable']: - response['info'] = None + del response['info'] return response diff --git a/test/commands/extended/is_promotable_test.py b/test/commands/extended/is_promotable_test.py index 6710a35f..ad991789 100644 --- a/test/commands/extended/is_promotable_test.py +++ b/test/commands/extended/is_promotable_test.py @@ -317,7 +317,6 @@ def test_happy_path(self): { 'promotable': True, - 'info': None, } )