diff --git a/aea/test_tools/generic.py b/aea/test_tools/generic.py index b9adc8267a..d55ad6bc31 100644 --- a/aea/test_tools/generic.py +++ b/aea/test_tools/generic.py @@ -117,10 +117,13 @@ def get_nested_ordered_dict_from_keys_and_value( return _dic root_key = keys[0] - if isinstance(configuration_obj, SkillConfig): + if ( + isinstance(configuration_obj, SkillConfig) + and root_key in SkillConfig.FIELDS_WITH_NESTED_FIELDS + ): root_attr = getattr(configuration_obj, root_key) length = len(keys) - if length < 3: + if length < 3 or keys[2] not in SkillConfig.NESTED_FIELDS_ALLOWED_TO_UPDATE: raise ValueError(f"Invalid keys={keys}.") # pragma: nocover skill_component_id = keys[1] skill_component_config = root_attr.read(skill_component_id)