Remove unused file (monkey_island/config_file_parser.py) and its test file (tests/unit_tests/monkey_island/test_config_file_parser.py)

This commit is contained in:
Shreya 2021-05-26 19:16:46 +05:30
parent a211c0f1bd
commit 31d65301d4
2 changed files with 0 additions and 35 deletions

View File

@ -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

View File

@ -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