diff options
author | Thomas Duval <thomas.duval@orange.com> | 2017-12-28 11:42:07 +0100 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2017-12-28 14:28:00 +0100 |
commit | 5bdbd6fc5b3f1aac00e20958c2d1307dd36a9f44 (patch) | |
tree | a6c28f48388efc68d42ad95dd8acf6bb23089798 /python_moonutilities/tests/unit_python | |
parent | 9cf58823b4fa426816acfef81a562054d26afde8 (diff) |
Clean the code
Change-Id: If508aa1ac6fd439dc6da916868b60adfce3dd72d
Diffstat (limited to 'python_moonutilities/tests/unit_python')
-rw-r--r-- | python_moonutilities/tests/unit_python/mock_repo/components_utilities.py | 2 | ||||
-rw-r--r-- | python_moonutilities/tests/unit_python/test_configuration.py | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/python_moonutilities/tests/unit_python/mock_repo/components_utilities.py b/python_moonutilities/tests/unit_python/mock_repo/components_utilities.py index 72956f3a..1d79d890 100644 --- a/python_moonutilities/tests/unit_python/mock_repo/components_utilities.py +++ b/python_moonutilities/tests/unit_python/mock_repo/components_utilities.py @@ -55,7 +55,7 @@ CONF = { "logging": { "handlers": { "file": { - "filename": "C:/moon.log", + "filename": "/tmp/moon.log", "class": "logging.handlers.RotatingFileHandler", "level": "DEBUG", "formatter": "custom", diff --git a/python_moonutilities/tests/unit_python/test_configuration.py b/python_moonutilities/tests/unit_python/test_configuration.py index fe01c7e2..10618f1c 100644 --- a/python_moonutilities/tests/unit_python/test_configuration.py +++ b/python_moonutilities/tests/unit_python/test_configuration.py @@ -3,11 +3,11 @@ import pytest import requests_mock - def test_get_configuration_success(): from python_moonutilities import configuration assert configuration.get_configuration("components/port_start")["components/port_start"] == comp_util.CONF["components"]["port_start"] + @requests_mock.Mocker(kw='mock') def test_get_configuration_not_found(**kwargs): from python_moonutilities import configuration @@ -18,6 +18,7 @@ def test_get_configuration_not_found(**kwargs): configuration.get_configuration("components/port_start_wrong") assert str(exception_info.value) == '500: Consul error' + # [TODO] this test used to test the invalid response # it should be un commented and run after refactoring the related part @requests_mock.Mocker(kw='mock') @@ -31,6 +32,7 @@ def test_get_configuration_invalid_response(**kwargs): # configuration.get_configuration("components_port_start") # assert str(exception_info.value) == '500: Consul error' + @requests_mock.Mocker(kw='mock') def test_put_increment_port_failure(**kwargs): from python_moonutilities import configuration @@ -42,6 +44,7 @@ def test_put_increment_port_failure(**kwargs): configuration.increment_port() assert str(exception_info.value) == '400: Consul error' + def test_increment_port_success(): from python_moonutilities import configuration cur_port = comp_util.CONF["components"]["port_start"] |