From e61bac0895b50c0e1b131d2c211becb1bfc03327 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 1 Dec 2021 07:38:37 -0500 Subject: [PATCH] Tests: Test get_server_config() instead of internal _extract_config() --- .../setup/{test_server_setup.py => test_config_setup.py} | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) rename monkey/tests/unit_tests/monkey_island/cc/setup/{test_server_setup.py => test_config_setup.py} (95%) diff --git a/monkey/tests/unit_tests/monkey_island/cc/setup/test_server_setup.py b/monkey/tests/unit_tests/monkey_island/cc/setup/test_config_setup.py similarity index 95% rename from monkey/tests/unit_tests/monkey_island/cc/setup/test_server_setup.py rename to monkey/tests/unit_tests/monkey_island/cc/setup/test_config_setup.py index a43233026..88e1850a7 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/setup/test_server_setup.py +++ b/monkey/tests/unit_tests/monkey_island/cc/setup/test_config_setup.py @@ -1,3 +1,4 @@ +import json from json import dumps from pathlib import Path @@ -5,8 +6,8 @@ import pytest import monkey_island.cc.setup.config_setup # noqa: F401 from monkey_island.cc.arg_parser import IslandCmdArgs -from monkey_island.cc.server_setup import _extract_config, get_server_config from monkey_island.cc.server_utils.file_utils import is_windows_os +from monkey_island.cc.setup.config_setup import get_server_config from monkey_island.cc.setup.island_config_options import IslandConfigOptions @@ -91,5 +92,5 @@ BAD_JSON = '{"data_dir": "C:\\test\\test"' def test_malformed_json(cmd_server_config_path, cmd_args_with_server_config): create_server_config(BAD_JSON, cmd_server_config_path) - with pytest.raises(SystemExit): - _extract_config(cmd_args_with_server_config) + with pytest.raises(json.JSONDecodeError): + get_server_config(cmd_args_with_server_config)