[Kimchi-devel] [PATCH] [WoK 3/5] reload API: new file tests/test_config_model.py

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Wed Jan 18 20:55:28 UTC 2017


From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>

Created a new unit test file for model/config.py since the
existing test_config.py is testing WokConfig.

Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
---
 tests/test_config_model.py | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 tests/test_config_model.py

diff --git a/tests/test_config_model.py b/tests/test_config_model.py
new file mode 100644
index 0000000..f8b0848
--- /dev/null
+++ b/tests/test_config_model.py
@@ -0,0 +1,41 @@
+#
+# Project Wok
+#
+# Copyright IBM Corp, 2017
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+
+import mock
+import unittest
+
+from wok.model import model
+
+
+class ConfigModelTests(unittest.TestCase):
+
+    def test_config_lookup(self):
+        inst = model.Model()
+        config = inst.config_lookup('')
+        self.assertItemsEqual(
+            ['proxy_port', 'websockets_port', 'auth',
+             'server_root', 'version'],
+            config.keys()
+        )
+
+    @mock.patch('cherrypy.engine.restart')
+    def test_config_reload(self, mock_restart):
+        inst = model.Model()
+        inst.config_reload('')
+        mock_restart.assert_called_once_with()
-- 
2.7.4



More information about the Kimchi-devel mailing list