cc: move DEFAULT_SERVER_CONFIG_PATH to consts.py
This commit is contained in:
parent
0230c26f19
commit
1d73f6e860
|
@ -6,13 +6,11 @@ from pathlib import Path
|
|||
from typing import Dict, List
|
||||
|
||||
import monkey_island.cc.environment.server_config_generator as server_config_generator
|
||||
from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH
|
||||
from monkey_island.cc.server_utils.consts import DEFAULT_SERVER_CONFIG_PATH
|
||||
from monkey_island.cc.environment.user_creds import UserCreds
|
||||
from monkey_island.cc.resources.auth.auth_user import User
|
||||
from monkey_island.cc.resources.auth.user_store import UserStore
|
||||
|
||||
SERVER_CONFIG_FILENAME = "server_config.json"
|
||||
DEFAULT_SERVER_CONFIG_PATH = os.path.join(MONKEY_ISLAND_ABS_PATH, 'cc', SERVER_CONFIG_FILENAME)
|
||||
|
||||
|
||||
class EnvironmentConfig:
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
import monkey_island.cc.resources.auth.user_store as user_store
|
||||
from monkey_island.cc.environment import (EnvironmentConfig, aws, password,
|
||||
standard, testing)
|
||||
from monkey_island.cc.environment.environment_config import DEFAULT_SERVER_CONFIG_PATH
|
||||
from monkey_island.cc.consts import DEFAULT_SERVER_CONFIG_PATH
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import json
|
||||
import os
|
||||
import platform
|
||||
from typing import Dict
|
||||
from unittest import TestCase
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import monkey_island.cc.test_common.environment.server_config_mocks as config_mocks
|
||||
from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH
|
||||
from monkey_island.cc.environment.environment_config import EnvironmentConfig, DEFAULT_SERVER_CONFIG
|
||||
from monkey_island.cc.environment.environment_config import EnvironmentConfig
|
||||
from monkey_island.cc.environment.user_creds import UserCreds
|
||||
|
||||
|
||||
|
@ -56,13 +55,6 @@ class TestEnvironmentConfig(TestCase):
|
|||
|
||||
self.assertDictEqual(config, json.loads(content_from_file))
|
||||
|
||||
def test_default_server_config_file_path(self):
|
||||
if platform.system() == "Windows":
|
||||
server_file_path = MONKEY_ISLAND_ABS_PATH + r"\cc\server_config.json"
|
||||
else:
|
||||
server_file_path = MONKEY_ISLAND_ABS_PATH + "/cc/server_config.json"
|
||||
self.assertEqual(DEFAULT_SERVER_CONFIG_PATH, server_file_path)
|
||||
|
||||
def test_get_from_dict(self):
|
||||
config_dict = config_mocks.CONFIG_WITH_CREDENTIALS
|
||||
env_conf = EnvironmentConfig.get_from_dict(config_dict)
|
||||
|
|
|
@ -21,7 +21,7 @@ json_setup_logging(default_path=Path(MONKEY_ISLAND_ABS_PATH, 'cc', 'island_logge
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
import monkey_island.cc.environment.environment_singleton as env_singleton # noqa: E402
|
||||
from monkey_island.cc.environment.environment_config import DEFAULT_SERVER_CONFIG_PATH
|
||||
from monkey_island.cc.consts import DEFAULT_SERVER_CONFIG_PATH
|
||||
from common.version import get_version # noqa: E402
|
||||
from monkey_island.cc.app import init_app # noqa: E402
|
||||
from monkey_island.cc.server_utils.bootloader_server import BootloaderHttpServer # noqa: E402
|
||||
|
|
|
@ -4,3 +4,6 @@ __author__ = 'itay.mizeretz'
|
|||
|
||||
MONKEY_ISLAND_ABS_PATH = os.path.join(os.getcwd(), 'monkey_island')
|
||||
DEFAULT_MONKEY_TTL_EXPIRY_DURATION_IN_SECONDS = 60 * 5
|
||||
|
||||
_SERVER_CONFIG_FILENAME = "server_config.json"
|
||||
DEFAULT_SERVER_CONFIG_PATH = os.path.join(MONKEY_ISLAND_ABS_PATH, 'cc', _SERVER_CONFIG_FILENAME)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import platform
|
||||
import monkey_island.cc.consts as consts
|
||||
|
||||
|
||||
def test_default_server_config_file_path():
|
||||
if platform.system() == "Windows":
|
||||
server_file_path = consts.MONKEY_ISLAND_ABS_PATH + r"\cc\server_config.json"
|
||||
else:
|
||||
server_file_path = consts.MONKEY_ISLAND_ABS_PATH + "/cc/server_config.json"
|
||||
|
||||
assert consts.DEFAULT_SERVER_CONFIG_PATH == server_file_path
|
Loading…
Reference in New Issue