|
@@ -22,6 +22,7 @@
|
|
|
import unittest
|
|
|
import os
|
|
|
from isc.config.cfgmgr import *
|
|
|
+from isc.config import config_data
|
|
|
from unittest_fakesession import FakeModuleCCSession
|
|
|
|
|
|
class TestConfigManagerData(unittest.TestCase):
|
|
@@ -32,7 +33,7 @@ class TestConfigManagerData(unittest.TestCase):
|
|
|
|
|
|
def test_init(self):
|
|
|
self.assertEqual(self.config_manager_data.data['version'],
|
|
|
- ConfigManagerData.CONFIG_VERSION)
|
|
|
+ config_data.BIND10_CONFIG_DATA_VERSION)
|
|
|
self.assertEqual(self.config_manager_data.data_path,
|
|
|
self.data_path)
|
|
|
self.assertEqual(self.config_manager_data.db_filename,
|
|
@@ -52,6 +53,9 @@ class TestConfigManagerData(unittest.TestCase):
|
|
|
self.assertRaises(ConfigManagerDataReadError,
|
|
|
ConfigManagerData.read_from_file,
|
|
|
self.data_path, "b10-config-bad3.db")
|
|
|
+ self.assertRaises(ConfigManagerDataReadError,
|
|
|
+ ConfigManagerData.read_from_file,
|
|
|
+ self.data_path, "b10-config-bad4.db")
|
|
|
|
|
|
def test_write_to_file(self):
|
|
|
output_file_name = "b10-config-write-test";
|
|
@@ -161,13 +165,13 @@ class TestConfigManager(unittest.TestCase):
|
|
|
self.assertEqual(commands_spec['Spec2'], module_spec.get_commands_spec())
|
|
|
|
|
|
def test_read_config(self):
|
|
|
- self.assertEqual(self.cm.config.data, {'version': 1})
|
|
|
+ self.assertEqual(self.cm.config.data, {'version': config_data.BIND10_CONFIG_DATA_VERSION})
|
|
|
self.cm.read_config()
|
|
|
# due to what get written, the value here is what the last set_config command in test_handle_msg does
|
|
|
- self.assertEqual(self.cm.config.data, {'TestModule': {'test': 125}, 'version': 1})
|
|
|
+ self.assertEqual(self.cm.config.data, {'TestModule': {'test': 125}, 'version': config_data.BIND10_CONFIG_DATA_VERSION})
|
|
|
self.cm.data_path = "/no_such_path"
|
|
|
self.cm.read_config()
|
|
|
- self.assertEqual(self.cm.config.data, {'version': 1})
|
|
|
+ self.assertEqual(self.cm.config.data, {'version': config_data.BIND10_CONFIG_DATA_VERSION})
|
|
|
|
|
|
def test_write_config(self):
|
|
|
# tested in ConfigManagerData tests
|
|
@@ -190,9 +194,9 @@ class TestConfigManager(unittest.TestCase):
|
|
|
{'result': [1, 'Bad get_module_spec command, argument not a dict']})
|
|
|
self._handle_msg_helper({ "command": [ "get_module_spec", { } ] },
|
|
|
{'result': [1, 'Bad module_name in get_module_spec command']})
|
|
|
- self._handle_msg_helper({ "command": [ "get_config" ] }, { 'result': [ 0, { 'version': 1} ]})
|
|
|
+ self._handle_msg_helper({ "command": [ "get_config" ] }, { 'result': [ 0, { 'version': config_data.BIND10_CONFIG_DATA_VERSION } ]})
|
|
|
self._handle_msg_helper({ "command": [ "get_config", { "module_name": "nosuchmodule" } ] },
|
|
|
- {'result': [0, { 'version': 1 }]})
|
|
|
+ {'result': [0, { 'version': config_data.BIND10_CONFIG_DATA_VERSION }]})
|
|
|
self._handle_msg_helper({ "command": [ "get_config", 1 ] },
|
|
|
{'result': [1, 'Bad get_config command, argument not a dict']})
|
|
|
self._handle_msg_helper({ "command": [ "get_config", { } ] },
|