
On 01/16/2017 03:49 PM, Aline Manera wrote:
On 01/12/2017 02:41 PM, dhbarboza82@gmail.com wrote:
From: Daniel Henrique Barboza <danielhb@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@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..d07032d --- /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_restart(self, mock_restart): + inst = model.Model() + inst.config_restart('') + mock_restart.assert_called_once_with()
Please, update Mockmodel for the tests needs and add tests using the API.
I'll add tests in test_rest.py. There is no mockmodel in WoK :) Daniel
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel