Commit a3cf5322 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Merge #1515

parents 55982f50 0d120aa6
......@@ -65,3 +65,4 @@ EXTRA_DIST += spec35.spec
EXTRA_DIST += spec36.spec
EXTRA_DIST += spec37.spec
EXTRA_DIST += spec38.spec
EXTRA_DIST += spec39.spec
{
"module_spec": {
"module_name": "Spec39",
"config_data": [
{ "item_name": "list",
"item_type": "list",
"item_optional": false,
"item_default": [],
"list_item_spec": {
"item_name": "list_item",
"item_type": "boolean",
"item_optional": false,
"item_default": false
}
}
],
"commands": [],
"statistics": []
}
}
......@@ -451,9 +451,9 @@ class UIModuleCCSession(MultiConfigData):
cur_list.append(value)
self.set_value(identifier, cur_list)
else:
raise isc.cc.data.DataAlreadyPresentError(value +
raise isc.cc.data.DataAlreadyPresentError(str(value) +
" already in "
+ identifier)
+ str(identifier))
def _add_value_to_named_set(self, identifier, value, item_value):
if type(value) != str:
......
......@@ -701,6 +701,12 @@ class TestUIModuleCCSession(unittest.TestCase):
fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION })
return UIModuleCCSession(fake_conn)
def create_uccs_listtest(self, fake_conn):
module_spec = isc.config.module_spec_from_file(self.spec_file("spec39.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 })
return UIModuleCCSession(fake_conn)
def test_init(self):
fake_conn = fakeUIConn()
fake_conn.set_get_answer('/module_spec', {})
......@@ -751,6 +757,14 @@ class TestUIModuleCCSession(unittest.TestCase):
self.assertRaises(isc.cc.data.DataTypeError,
uccs.remove_value, "Spec2/item5", None)
def test_add_dup_value(self):
fake_conn = fakeUIConn()
uccs = self.create_uccs_listtest(fake_conn)
uccs.add_value("Spec39/list")
self.assertRaises(isc.cc.data.DataAlreadyPresentError, uccs.add_value,
"Spec39/list")
def test_add_remove_value_named_set(self):
fake_conn = fakeUIConn()
uccs = self.create_uccs_named_set(fake_conn)
......@@ -787,6 +801,8 @@ class TestUIModuleCCSession(unittest.TestCase):
self.assertRaises(isc.cc.data.DataNotFoundError,
uccs.remove_value, "/Spec32/named_set_item",
"no_such_item")
self.assertRaises(isc.cc.data.DataAlreadyPresentError,
uccs.add_value, "/Spec32/named_set_item", "c")
def test_set_value_named_set(self):
fake_conn = fakeUIConn()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment