[Kimchi-devel] [PATCH] [WoK 4/5] reload API: added rest API tests

Lucio Correia luciojhc at linux.vnet.ibm.com
Wed Jan 18 18:03:53 UTC 2017


On 18/01/2017 14:24, dhbarboza82 at gmail.com wrote:
> From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
>
> This patch adds a new test in test_api to assert the function
> of the 'reload' API.
>
> Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
> ---
>  tests/test_api.py | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tests/test_api.py b/tests/test_api.py
> index 23c263d..7ed8144 100644
> --- a/tests/test_api.py
> +++ b/tests/test_api.py
> @@ -1,7 +1,7 @@
>  #
>  # Project Wok
>  #
> -# Copyright IBM Corp, 2016
> +# Copyright IBM Corp, 2016-2017
>  #
>  # This library is free software; you can redistribute it and/or
>  # modify it under the terms of the GNU Lesser General Public
> @@ -18,6 +18,7 @@
>  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
>
>  import json
> +import mock
>  import time
>  import unittest
>  import utils
> @@ -102,3 +103,9 @@ class APITests(unittest.TestCase):
>          self.assertEquals(204, resp.status)
>          task = json.loads(self.request('/tasks/%s' % taskid).read())
>          self.assertEquals('killed', task['status'])
> +
> +    @mock.patch('cherrypy.engine.restart')
> +    def test_config_reload(self, mock_restart):
> +        resp = self.request('/config/reload', '{}', 'POST')
> +        self.assertEquals(200, resp.status)
> +        mock_restart.assert_called_once_with

Missing ()

>


-- 
Lucio Correia



More information about the Kimchi-devel mailing list