Commit 1f26ac53 authored by Jelte Jansen's avatar Jelte Jansen

[trac926] call it 'named set', not 'named map'

(to avoid confusion with 'normal' maps)
parent 71fb1054
...@@ -636,11 +636,11 @@ class BindCmdInterpreter(Cmd): ...@@ -636,11 +636,11 @@ class BindCmdInterpreter(Cmd):
# we have more data to show # we have more data to show
line += "/" line += "/"
else: else:
# if type is named_map, don't print value if None # if type is named_set, don't print value if None
# (it is either {} meaning empty, or None, meaning # (it is either {} meaning empty, or None, meaning
# there actually is data, but not to be shown with # there actually is data, but not to be shown with
# the current command # the current command
if value_map['type'] == 'named_map' and\ if value_map['type'] == 'named_set' and\
value_map['value'] is None: value_map['value'] is None:
line += "/\t" line += "/\t"
else: else:
......
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
} }
}, },
{ "item_name": "new_zones", { "item_name": "new_zones",
"item_type": "named_map", "item_type": "named_set",
"item_optional": false, "item_optional": false,
"item_default": {}, "item_default": {},
"named_map_item_spec": { "named_set_item_spec": {
"item_name": "zone", "item_name": "zone",
"item_type": "map", "item_type": "map",
"item_default": {}, "item_default": {},
......
...@@ -511,7 +511,7 @@ Element::nameToType(const std::string& type_name) { ...@@ -511,7 +511,7 @@ Element::nameToType(const std::string& type_name) {
return (Element::list); return (Element::list);
} else if (type_name == "map") { } else if (type_name == "map") {
return (Element::map); return (Element::map);
} else if (type_name == "named_map") { } else if (type_name == "named_set") {
return (Element::map); return (Element::map);
} else if (type_name == "null") { } else if (type_name == "null") {
return (Element::null); return (Element::null);
......
...@@ -71,9 +71,9 @@ check_config_item(ConstElementPtr spec) { ...@@ -71,9 +71,9 @@ check_config_item(ConstElementPtr spec) {
if (spec->get("item_type")->stringValue() == "map") { if (spec->get("item_type")->stringValue() == "map") {
check_leaf_item(spec, "map_item_spec", Element::list, true); check_leaf_item(spec, "map_item_spec", Element::list, true);
check_config_item_list(spec->get("map_item_spec")); check_config_item_list(spec->get("map_item_spec"));
} else if (spec->get("item_type")->stringValue() == "named_map") { } else if (spec->get("item_type")->stringValue() == "named_set") {
check_leaf_item(spec, "named_map_item_spec", Element::map, true); check_leaf_item(spec, "named_set_item_spec", Element::map, true);
check_config_item(spec->get("named_map_item_spec")); check_config_item(spec->get("named_set_item_spec"));
} }
} }
...@@ -290,7 +290,7 @@ check_type(ConstElementPtr spec, ConstElementPtr element) { ...@@ -290,7 +290,7 @@ check_type(ConstElementPtr spec, ConstElementPtr element) {
break; break;
case Element::map: case Element::map:
return (cur_item_type == "map" || return (cur_item_type == "map" ||
cur_item_type == "named_map"); cur_item_type == "named_set");
break; break;
} }
return (false); return (false);
...@@ -327,7 +327,7 @@ ModuleSpec::validateItem(ConstElementPtr spec, ConstElementPtr data, ...@@ -327,7 +327,7 @@ ModuleSpec::validateItem(ConstElementPtr spec, ConstElementPtr data,
} }
} }
if (data->getType() == Element::map) { if (data->getType() == Element::map) {
// either a 'normal' map or a 'named' map // either a 'normal' map or a 'named' set
if (spec->contains("map_item_spec")) { if (spec->contains("map_item_spec")) {
if (!validateSpecList(spec->get("map_item_spec"), data, full, errors)) { if (!validateSpecList(spec->get("map_item_spec"), data, full, errors)) {
return (false); return (false);
...@@ -336,7 +336,7 @@ ModuleSpec::validateItem(ConstElementPtr spec, ConstElementPtr data, ...@@ -336,7 +336,7 @@ ModuleSpec::validateItem(ConstElementPtr spec, ConstElementPtr data,
typedef std::pair<std::string, ConstElementPtr> maptype; typedef std::pair<std::string, ConstElementPtr> maptype;
BOOST_FOREACH(maptype m, data->mapValue()) { BOOST_FOREACH(maptype m, data->mapValue()) {
if (!validateItem(spec->get("named_map_item_spec"), m.second, full, errors)) { if (!validateItem(spec->get("named_set_item_spec"), m.second, full, errors)) {
return (false); return (false);
} }
} }
......
...@@ -212,7 +212,7 @@ TEST(ModuleSpec, CommandValidation) { ...@@ -212,7 +212,7 @@ TEST(ModuleSpec, CommandValidation) {
} }
TEST(ModuleSpec, NamedMapValidation) { TEST(ModuleSpec, NamedSetValidation) {
ModuleSpec dd = moduleSpecFromFile(specfile("spec32.spec")); ModuleSpec dd = moduleSpecFromFile(specfile("spec32.spec"));
ElementPtr errors = Element::createList(); ElementPtr errors = Element::createList();
......
{ {
"named_map_item": { "foo": 1, "bar": 2 } "named_set_item": { "foo": 1, "bar": 2 }
} }
{ {
"named_map_item": { "foo": "wrongtype", "bar": 2 } "named_set_item": { "foo": "wrongtype", "bar": 2 }
} }
{ {
"named_map_item": [] "named_set_item": []
} }
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
"module_spec": { "module_spec": {
"module_name": "Spec32", "module_name": "Spec32",
"config_data": [ "config_data": [
{ "item_name": "named_map_item", { "item_name": "named_set_item",
"item_type": "named_map", "item_type": "named_set",
"item_optional": false, "item_optional": false,
"item_default": { "a": 1, "b": 2 }, "item_default": { "a": 1, "b": 2 },
"named_map_item_spec": { "named_set_item_spec": {
"item_name": "named_map_element", "item_name": "named_set_element",
"item_type": "integer", "item_type": "integer",
"item_optional": false, "item_optional": false,
"item_default": 3 "item_default": 3
......
...@@ -444,11 +444,11 @@ class UIModuleCCSession(MultiConfigData): ...@@ -444,11 +444,11 @@ class UIModuleCCSession(MultiConfigData):
else: else:
raise isc.cc.data.DataAlreadyPresentError(value + " already in " + identifier) raise isc.cc.data.DataAlreadyPresentError(value + " already in " + identifier)
def _add_value_to_named_map(self, identifier, value, item_value): def _add_value_to_named_set(self, identifier, value, item_value):
if value is None: if value is None:
raise isc.cc.data.DataNotFoundError("Need a name to add a new item to named_map " + str(identifier)) raise isc.cc.data.DataNotFoundError("Need a name to add a new item to named_set " + str(identifier))
elif type(value) != str: elif type(value) != str:
raise isc.cc.data.DataTypeError("Name for named_map " + identifier + " must be a string") raise isc.cc.data.DataTypeError("Name for named_set " + identifier + " must be a string")
else: else:
cur_map, status = self.get_value(identifier) cur_map, status = self.get_value(identifier)
if not cur_map: if not cur_map:
...@@ -477,16 +477,16 @@ class UIModuleCCSession(MultiConfigData): ...@@ -477,16 +477,16 @@ class UIModuleCCSession(MultiConfigData):
if value_str is not None: if value_str is not None:
value = isc.cc.data.parse_value_str(value_str) value = isc.cc.data.parse_value_str(value_str)
# the specified element must be a list or a named_map # the specified element must be a list or a named_set
if 'list_item_spec' in module_spec: if 'list_item_spec' in module_spec:
self._add_value_to_list(identifier, value) self._add_value_to_list(identifier, value)
elif 'named_map_item_spec' in module_spec: elif 'named_set_item_spec' in module_spec:
item_value = None item_value = None
if 'item_default' in module_spec['named_map_item_spec']: if 'item_default' in module_spec['named_set_item_spec']:
item_value = module_spec['named_map_item_spec']['item_default'] item_value = module_spec['named_set_item_spec']['item_default']
self._add_value_to_named_map(identifier, value, item_value) self._add_value_to_named_set(identifier, value, item_value)
else: else:
raise isc.cc.data.DataNotFoundError(str(identifier) + " is not a list or a named map") raise isc.cc.data.DataNotFoundError(str(identifier) + " is not a list or a named set")
def _remove_value_from_list(self, identifier, value): def _remove_value_from_list(self, identifier, value):
if value is None: if value is None:
...@@ -504,11 +504,11 @@ class UIModuleCCSession(MultiConfigData): ...@@ -504,11 +504,11 @@ class UIModuleCCSession(MultiConfigData):
cur_list.remove(value) cur_list.remove(value)
self.set_value(identifier, cur_list) self.set_value(identifier, cur_list)
def _remove_value_from_named_map(self, identifier, value): def _remove_value_from_named_set(self, identifier, value):
if value is None: if value is None:
raise isc.cc.data.DataNotFoundError("Need a name to remove an item from named_map " + str(identifier)) raise isc.cc.data.DataNotFoundError("Need a name to remove an item from named_set " + str(identifier))
elif type(value) != str: elif type(value) != str:
raise isc.cc.data.DataTypeError("Name for named_map " + identifier + " must be a string") raise isc.cc.data.DataTypeError("Name for named_set " + identifier + " must be a string")
else: else:
cur_map, status = self.get_value(identifier) cur_map, status = self.get_value(identifier)
if not cur_map: if not cur_map:
...@@ -516,10 +516,10 @@ class UIModuleCCSession(MultiConfigData): ...@@ -516,10 +516,10 @@ class UIModuleCCSession(MultiConfigData):
if value in cur_map: if value in cur_map:
del cur_map[value] del cur_map[value]
else: else:
raise isc.cc.data.DataNotFoundError(value + " not found in named_map " + str(identifier)) raise isc.cc.data.DataNotFoundError(value + " not found in named_set " + str(identifier))
def remove_value(self, identifier, value_str): def remove_value(self, identifier, value_str):
"""Remove a value from a configuration list or named map. """Remove a value from a configuration list or named set.
The value string must be a string representation of the full The value string must be a string representation of the full
item. Raises a DataTypeError if the value at the identifier item. Raises a DataTypeError if the value at the identifier
is not a list, or if the given value_str does not match the is not a list, or if the given value_str does not match the
...@@ -536,10 +536,10 @@ class UIModuleCCSession(MultiConfigData): ...@@ -536,10 +536,10 @@ class UIModuleCCSession(MultiConfigData):
if value is not None: if value is not None:
isc.config.config_data.check_type(module_spec['list_item_spec'], value) isc.config.config_data.check_type(module_spec['list_item_spec'], value)
self._remove_value_from_list(identifier, value) self._remove_value_from_list(identifier, value)
elif 'named_map_item_spec' in module_spec: elif 'named_set_item_spec' in module_spec:
self._remove_value_from_named_map(identifier, value) self._remove_value_from_named_set(identifier, value)
else: else:
raise isc.cc.data.DataNotFoundError(str(identifier) + " is not a list or a named_map") raise isc.cc.data.DataNotFoundError(str(identifier) + " is not a list or a named_set")
......
...@@ -145,8 +145,8 @@ def _find_spec_part_single(cur_spec, id_part): ...@@ -145,8 +145,8 @@ def _find_spec_part_single(cur_spec, id_part):
return cur_spec['list_item_spec'] return cur_spec['list_item_spec']
# not found # not found
raise isc.cc.data.DataNotFoundError(id + " not found") raise isc.cc.data.DataNotFoundError(id + " not found")
elif type(cur_spec) == dict and 'named_map_item_spec' in cur_spec.keys(): elif type(cur_spec) == dict and 'named_set_item_spec' in cur_spec.keys():
return cur_spec['named_map_item_spec'] return cur_spec['named_set_item_spec']
elif type(cur_spec) == list: elif type(cur_spec) == list:
for cur_spec_item in cur_spec: for cur_spec_item in cur_spec:
if cur_spec_item['item_name'] == id: if cur_spec_item['item_name'] == id:
...@@ -193,7 +193,7 @@ def spec_name_list(spec, prefix="", recurse=False): ...@@ -193,7 +193,7 @@ def spec_name_list(spec, prefix="", recurse=False):
result.extend(spec_name_list(map_el['map_item_spec'], prefix + map_el['item_name'], recurse)) result.extend(spec_name_list(map_el['map_item_spec'], prefix + map_el['item_name'], recurse))
else: else:
result.append(prefix + name) result.append(prefix + name)
elif 'named_map_item_spec' in spec: elif 'named_set_item_spec' in spec:
# we added a '/' above, but in this one case we don't want it # we added a '/' above, but in this one case we don't want it
result.append(prefix[:-1]) result.append(prefix[:-1])
pass pass
...@@ -419,7 +419,7 @@ class MultiConfigData: ...@@ -419,7 +419,7 @@ class MultiConfigData:
id_list = module + "/" + id_prefix + "/" + item_id id_list = module + "/" + id_prefix + "/" + item_id
id_prefix += "/" + id_part id_prefix += "/" + id_part
part_spec = find_spec_part(self._specifications[module].get_config_spec(), id_prefix) part_spec = find_spec_part(self._specifications[module].get_config_spec(), id_prefix)
if part_spec['item_type'] == 'named_map': if part_spec['item_type'] == 'named_set':
if len(id_parts) == 0: if len(id_parts) == 0:
if 'item_default' in part_spec: if 'item_default' in part_spec:
return part_spec['item_default'] return part_spec['item_default']
...@@ -427,21 +427,21 @@ class MultiConfigData: ...@@ -427,21 +427,21 @@ class MultiConfigData:
return None return None
id_part = id_parts.pop(0) id_part = id_parts.pop(0)
named_map_value, type = self.get_value(id_list) named_set_value, type = self.get_value(id_list)
if id_part in named_map_value: if id_part in named_set_value:
if len(id_parts) > 0: if len(id_parts) > 0:
# we are looking for the *default* value. # we are looking for the *default* value.
# so if not present in here, we need to # so if not present in here, we need to
# lookup the one from the spec # lookup the one from the spec
rest_of_id = "/".join(id_parts) rest_of_id = "/".join(id_parts)
result = isc.cc.data.find_no_exc(named_map_value[id_part], rest_of_id) result = isc.cc.data.find_no_exc(named_set_value[id_part], rest_of_id)
if result is None: if result is None:
spec_part = self.find_spec_part(identifier) spec_part = self.find_spec_part(identifier)
if 'item_default' in spec_part: if 'item_default' in spec_part:
return spec_part['item_default'] return spec_part['item_default']
return result return result
else: else:
return named_map_value[id_part] return named_set_value[id_part]
else: else:
return None return None
elif list_indices is not None: elif list_indices is not None:
...@@ -481,9 +481,9 @@ class MultiConfigData: ...@@ -481,9 +481,9 @@ class MultiConfigData:
spec = find_spec_part(self._specifications[module].get_config_spec(), id) spec = find_spec_part(self._specifications[module].get_config_spec(), id)
if 'item_default' in spec: if 'item_default' in spec:
# one special case, named_map # one special case, named_set
if spec['item_type'] == 'named_map': if spec['item_type'] == 'named_set':
print("is " + id_part + " in named map?") print("is " + id_part + " in named set?")
return spec['item_default'] return spec['item_default']
else: else:
return spec['item_default'] return spec['item_default']
...@@ -551,7 +551,7 @@ class MultiConfigData: ...@@ -551,7 +551,7 @@ class MultiConfigData:
# almost never interested in just its name # almost never interested in just its name
spec_part_map = spec_part['map_item_spec'] spec_part_map = spec_part['map_item_spec']
self._append_value_item(result, spec_part_map, identifier, all) self._append_value_item(result, spec_part_map, identifier, all)
elif item_type == "named_map": elif item_type == "named_set":
value, status = self.get_value(identifier) value, status = self.get_value(identifier)
# show just the one entry, when either the map is empty, # show just the one entry, when either the map is empty,
...@@ -567,10 +567,10 @@ class MultiConfigData: ...@@ -567,10 +567,10 @@ class MultiConfigData:
None, status) None, status)
result.append(entry) result.append(entry)
else: else:
spec_part_named_map = spec_part['named_map_item_spec'] spec_part_named_set = spec_part['named_set_item_spec']
for entry in value: for entry in value:
self._append_value_item(result, self._append_value_item(result,
spec_part_named_map, spec_part_named_set,
identifier + "/" + entry, identifier + "/" + entry,
all) all)
else: else:
...@@ -667,16 +667,16 @@ class MultiConfigData: ...@@ -667,16 +667,16 @@ class MultiConfigData:
def _get_list_items(self, item_name): def _get_list_items(self, item_name):
"""This method is used in get_config_item_list, to add list """This method is used in get_config_item_list, to add list
indices and named_map names to the completion list. If indices and named_set names to the completion list. If
the given item_name is for a list or named_map, it'll the given item_name is for a list or named_set, it'll
return a list of those (appended to item_name), otherwise return a list of those (appended to item_name), otherwise
the list will only contain the item_name itself.""" the list will only contain the item_name itself."""
spec_part = self.find_spec_part(item_name) spec_part = self.find_spec_part(item_name)
if 'item_type' in spec_part and \ if 'item_type' in spec_part and \
spec_part['item_type'] == 'named_map': spec_part['item_type'] == 'named_set':
subslash = "" subslash = ""
if spec_part['named_map_item_spec']['item_type'] == 'map' or\ if spec_part['named_set_item_spec']['item_type'] == 'map' or\
spec_part['named_map_item_spec']['item_type'] == 'named_map': spec_part['named_set_item_spec']['item_type'] == 'named_set':
subslash = "/" subslash = "/"
values, status = self.get_value(item_name) values, status = self.get_value(item_name)
if len(values) > 0: if len(values) > 0:
......
...@@ -229,7 +229,7 @@ def _check_item_spec(config_item): ...@@ -229,7 +229,7 @@ def _check_item_spec(config_item):
item_type = config_item["item_type"] item_type = config_item["item_type"]
if type(item_type) != str: if type(item_type) != str:
raise ModuleSpecError("item_type in " + item_name + " is not a string: " + str(type(item_type))) raise ModuleSpecError("item_type in " + item_name + " is not a string: " + str(type(item_type)))
if item_type not in ["integer", "real", "boolean", "string", "list", "map", "named_map", "any"]: if item_type not in ["integer", "real", "boolean", "string", "list", "map", "named_set", "any"]:
raise ModuleSpecError("unknown item_type in " + item_name + ": " + item_type) raise ModuleSpecError("unknown item_type in " + item_name + ": " + item_type)
if "item_optional" in config_item: if "item_optional" in config_item:
if type(config_item["item_optional"]) != bool: if type(config_item["item_optional"]) != bool:
...@@ -293,7 +293,7 @@ def _validate_type(spec, value, errors): ...@@ -293,7 +293,7 @@ def _validate_type(spec, value, errors):
if errors != None: if errors != None:
errors.append(str(value) + " should be a map") errors.append(str(value) + " should be a map")
return False return False
elif data_type == "named_map" and type(value) != dict: elif data_type == "named_set" and type(value) != dict:
if errors != None: if errors != None:
errors.append(str(value) + " should be a map") errors.append(str(value) + " should be a map")
return False return False
...@@ -316,11 +316,11 @@ def _validate_item(spec, full, data, errors): ...@@ -316,11 +316,11 @@ def _validate_item(spec, full, data, errors):
if not _validate_spec_list(spec['map_item_spec'], full, data, errors): if not _validate_spec_list(spec['map_item_spec'], full, data, errors):
return False return False
else: else:
named_map_spec = spec['named_map_item_spec'] named_set_spec = spec['named_set_item_spec']
for data_el in data.values(): for data_el in data.values():
if not _validate_type(named_map_spec, data_el, errors): if not _validate_type(named_set_spec, data_el, errors):
return False return False
if not _validate_item(named_map_spec, full, data_el, errors): if not _validate_item(named_set_spec, full, data_el, errors):
return False return False
return True return True
......
...@@ -691,7 +691,7 @@ class TestUIModuleCCSession(unittest.TestCase): ...@@ -691,7 +691,7 @@ class TestUIModuleCCSession(unittest.TestCase):
fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION }) fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION })
return UIModuleCCSession(fake_conn) return UIModuleCCSession(fake_conn)
def create_uccs_named_map(self, fake_conn): def create_uccs_named_set(self, fake_conn):
module_spec = isc.config.module_spec_from_file(self.spec_file("spec32.spec")) module_spec = isc.config.module_spec_from_file(self.spec_file("spec32.spec"))
fake_conn.set_get_answer('/module_spec', { module_spec.get_module_name(): module_spec.get_full_spec()}) fake_conn.set_get_answer('/module_spec', { module_spec.get_module_name(): module_spec.get_full_spec()})
fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION }) fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION })
...@@ -742,26 +742,26 @@ class TestUIModuleCCSession(unittest.TestCase): ...@@ -742,26 +742,26 @@ class TestUIModuleCCSession(unittest.TestCase):
uccs.remove_value("Spec2/item5[0]", None) uccs.remove_value("Spec2/item5[0]", None)
self.assertEqual({'Spec2': {'item5': []}}, uccs._local_changes) self.assertEqual({'Spec2': {'item5': []}}, uccs._local_changes)
def test_add_remove_value_named_map(self): def test_add_remove_value_named_set(self):
fake_conn = fakeUIConn() fake_conn = fakeUIConn()
uccs = self.create_uccs_named_map(fake_conn) uccs = self.create_uccs_named_set(fake_conn)
value, status = uccs.get_value("/Spec32/named_map_item") value, status = uccs.get_value("/Spec32/named_set_item")
self.assertEqual({'a': 1, 'b': 2}, value) self.assertEqual({'a': 1, 'b': 2}, value)
uccs.add_value("/Spec32/named_map_item", "foo") uccs.add_value("/Spec32/named_set_item", "foo")
value, status = uccs.get_value("/Spec32/named_map_item") value, status = uccs.get_value("/Spec32/named_set_item")
self.assertEqual({'a': 1, 'b': 2, 'foo': 3}, value) self.assertEqual({'a': 1, 'b': 2, 'foo': 3}, value)
uccs.remove_value("/Spec32/named_map_item", "a") uccs.remove_value("/Spec32/named_set_item", "a")
uccs.remove_value("/Spec32/named_map_item", "foo") uccs.remove_value("/Spec32/named_set_item", "foo")
value, status = uccs.get_value("/Spec32/named_map_item") value, status = uccs.get_value("/Spec32/named_set_item")
self.assertEqual({'b': 2}, value) self.assertEqual({'b': 2}, value)
self.assertRaises(isc.cc.data.DataNotFoundError, self.assertRaises(isc.cc.data.DataNotFoundError,
uccs.set_value, uccs.set_value,
"/Spec32/named_map_item/no_such_item", "/Spec32/named_set_item/no_such_item",
4) 4)
self.assertRaises(isc.cc.data.DataNotFoundError, self.assertRaises(isc.cc.data.DataNotFoundError,
uccs.remove_value, "/Spec32/named_map_item", uccs.remove_value, "/Spec32/named_set_item",
"no_such_item") "no_such_item")
def test_commit(self): def test_commit(self):
......
...@@ -425,13 +425,13 @@ class TestMultiConfigData(unittest.TestCase): ...@@ -425,13 +425,13 @@ class TestMultiConfigData(unittest.TestCase):
module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec32.spec") module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec32.spec")
self.mcd.set_specification(module_spec) self.mcd.set_specification(module_spec)
value = self.mcd.get_default_value("Spec32/named_map_item") value = self.mcd.get_default_value("Spec32/named_set_item")
self.assertEqual({ 'a': 1, 'b': 2}, value) self.assertEqual({ 'a': 1, 'b': 2}, value)
value = self.mcd.get_default_value("Spec32/named_map_item/a") value = self.mcd.get_default_value("Spec32/named_set_item/a")
self.assertEqual(1, value) self.assertEqual(1, value)
value = self.mcd.get_default_value("Spec32/named_map_item/b") value = self.mcd.get_default_value("Spec32/named_set_item/b")
self.assertEqual(2, value) self.assertEqual(2, value)
value = self.mcd.get_default_value("Spec32/named_map_item/no_such_item") value = self.mcd.get_default_value("Spec32/named_set_item/no_such_item")
self.assertEqual(None, value) self.assertEqual(None, value)
def test_get_value(self): def test_get_value(self):
...@@ -557,27 +557,27 @@ class TestMultiConfigData(unittest.TestCase): ...@@ -557,27 +557,27 @@ class TestMultiConfigData(unittest.TestCase):
maps = self.mcd.get_value_maps("/Spec22/value9") maps = self.mcd.get_value_maps("/Spec22/value9")
self.assertEqual(expected, maps) self.assertEqual(expected, maps)
def test_get_value_maps_named_map(self): def test_get_value_maps_named_set(self):
module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec32.spec") module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec32.spec")
self.mcd.set_specification(module_spec) self.mcd.set_specification(module_spec)
maps = self.mcd.get_value_maps() maps = self.mcd.get_value_maps()
self.assertEqual([{'default': False, 'type': 'module', self.assertEqual([{'default': False, 'type': 'module',
'name': 'Spec32', 'value': None, 'name': 'Spec32', 'value': None,
'modified': False}], maps) 'modified': False}], maps)
maps = self.mcd.get_value_maps("/Spec32/named_map_item") maps = self.mcd.get_value_maps("/Spec32/named_set_item")
self.assertEqual([{'default': True, 'type': 'integer', self.assertEqual([{'default': True, 'type': 'integer',
'name': 'Spec32/named_map_item/a', 'name': 'Spec32/named_set_item/a',
'value': 1, 'modified': False}, 'value': 1, 'modified': False},
{'default': True, 'type': 'integer', {'default': True, 'type': 'integer',
'name': 'Spec32/named_map_item/b', 'name': 'Spec32/named_set_item/b',
'value': 2, 'modified': False}], maps)