diff options
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"] |