diff --git a/gdk/commands/config/update/ConfigData.py b/gdk/commands/config/update/ConfigData.py index 5e5da0c4..7d78dd8e 100644 --- a/gdk/commands/config/update/ConfigData.py +++ b/gdk/commands/config/update/ConfigData.py @@ -162,8 +162,7 @@ def set_region(self, value): def set_publish_options(self, value): # value can be a dict object or a string - formatted_input = value.replace("'", '"') - new_value = json.loads(formatted_input) if isinstance(value, str) else value + new_value = json.loads(value.replace("'", '"')) if isinstance(value, str) else value self._set_publish_config_values(ConfigEnum.PUBLISH_OPTIONS.value, new_value) def set_gdk_version(self, value): diff --git a/gdk/commands/config/update/Prompter.py b/gdk/commands/config/update/Prompter.py index 2e7428c3..735f6537 100644 --- a/gdk/commands/config/update/Prompter.py +++ b/gdk/commands/config/update/Prompter.py @@ -62,7 +62,7 @@ def prompter(self, field, required, max_attempts=3): [ f"--{parser_argument}", self.interactive_prompt( - parser_argument, current_field_value, require + parser_argument, str(current_field_value), require ), ] ) diff --git a/tests/gdk/commands/config/update/test_ConfigData.py b/tests/gdk/commands/config/update/test_ConfigData.py index 2cf4aed9..dd845db2 100644 --- a/tests/gdk/commands/config/update/test_ConfigData.py +++ b/tests/gdk/commands/config/update/test_ConfigData.py @@ -102,11 +102,16 @@ def test_set_region(self): data.set_field(ConfigEnum.REGION, "random-region123") self.assertEqual(data.get_region(), "random-region123") - def test_set_publish_options(self): + def test_set_publish_options_str(self): data = ConfigData(self.field_dict) data.set_field(ConfigEnum.PUBLISH_OPTIONS, '{"bar": "foo"}') self.assertEqual(data.get_publish_options(), {"bar": "foo"}) + def test_set_publish_options_dict(self): + data = ConfigData(self.field_dict) + data.set_field(ConfigEnum.PUBLISH_OPTIONS, {"bar": "foo"}) + self.assertEqual(data.get_publish_options(), {"bar": "foo"}) + def test_set_gdk_version(self): data = ConfigData(self.field_dict) data.set_field(ConfigEnum.GDK_VERSION, "19.20.21")