From 31d65301d4f6241d4b00284aeab95a1663897b68 Mon Sep 17 00:00:00 2001 From: Shreya Date: Wed, 26 May 2021 19:16:46 +0530 Subject: [PATCH] Remove unused file (monkey_island/config_file_parser.py) and its test file (tests/unit_tests/monkey_island/test_config_file_parser.py) --- monkey/monkey_island/config_file_parser.py | 19 ------------------- .../monkey_island/test_config_file_parser.py | 16 ---------------- 2 files changed, 35 deletions(-) delete mode 100644 monkey/monkey_island/config_file_parser.py delete mode 100644 monkey/tests/unit_tests/monkey_island/test_config_file_parser.py diff --git a/monkey/monkey_island/config_file_parser.py b/monkey/monkey_island/config_file_parser.py deleted file mode 100644 index 830ae6720..000000000 --- a/monkey/monkey_island/config_file_parser.py +++ /dev/null @@ -1,19 +0,0 @@ -import json -from os.path import isfile - -from monkey_island.cc.server_utils.consts import DEFAULT_SERVER_CONFIG_PATH -from monkey_island.setup.island_config_options import IslandConfigOptions - - -def load_island_config_from_file(server_config_path: str) -> IslandConfigOptions: - config_contents = read_config_file(server_config_path) - return IslandConfigOptions(config_contents) - - -def read_config_file(server_config_path: str) -> dict: - if not server_config_path or not isfile(server_config_path): - server_config_path = DEFAULT_SERVER_CONFIG_PATH - with open(server_config_path, "r") as f: - config_content = f.read() - config = json.loads(config_content) - return config diff --git a/monkey/tests/unit_tests/monkey_island/test_config_file_parser.py b/monkey/tests/unit_tests/monkey_island/test_config_file_parser.py deleted file mode 100644 index db377e6e7..000000000 --- a/monkey/tests/unit_tests/monkey_island/test_config_file_parser.py +++ /dev/null @@ -1,16 +0,0 @@ -from monkey_island import config_file_parser -from monkey_island.cc.server_utils.consts import DEFAULT_DATA_DIR, DEFAULT_LOG_LEVEL - - -def test_load_server_config_from_file(server_config_init_only): - config = config_file_parser.load_island_config_from_file(server_config_init_only) - - assert config.data_dir == "~/.monkey_island" - assert config.log_level == "NOTICE" - - -def test_load_server_config_from_file_empty_file(monkeypatch, server_config_empty): - config = config_file_parser.load_island_config_from_file(server_config_empty) - - assert config.data_dir == DEFAULT_DATA_DIR - assert config.log_level == DEFAULT_LOG_LEVEL