From 70b404b9f5350b8050a5547804e0fc23c2cef00a Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 13 Jul 2022 09:19:30 -0400 Subject: [PATCH] Island: Remove the Database service's dependency on ConfigService --- monkey/monkey_island/cc/services/database.py | 3 +-- .../monkey_island/cc/setup/mongo/test_database_initializer.py | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/services/database.py b/monkey/monkey_island/cc/services/database.py index 3dd512026..a73e182f5 100644 --- a/monkey/monkey_island/cc/services/database.py +++ b/monkey/monkey_island/cc/services/database.py @@ -6,11 +6,11 @@ from monkey_island.cc.database import mongo from monkey_island.cc.models import Config from monkey_island.cc.models.agent_controls import AgentControls from monkey_island.cc.models.attack.attack_mitigations import AttackMitigations -from monkey_island.cc.services.config import ConfigService logger = logging.getLogger(__name__) +# NOTE: This service is being replaced by the RepositoryService class Database(object): def __init__(self): pass @@ -24,7 +24,6 @@ class Database(object): for x in mongo.db.collection_names() if Database._should_drop(x, reset_config) ] - ConfigService.init_config() Database.init_agent_controls() logger.info("DB was reset") return jsonify(status="OK") diff --git a/monkey/tests/unit_tests/monkey_island/cc/setup/mongo/test_database_initializer.py b/monkey/tests/unit_tests/monkey_island/cc/setup/mongo/test_database_initializer.py index 4afdbc969..c285c1448 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/setup/mongo/test_database_initializer.py +++ b/monkey/tests/unit_tests/monkey_island/cc/setup/mongo/test_database_initializer.py @@ -19,9 +19,6 @@ def patch_attack_mitigations_path(monkeypatch, data_for_tests_dir): @pytest.fixture(scope="module", autouse=True) def patch_dependencies(monkeypatch_session): - monkeypatch_session.setattr( - "monkey_island.cc.services.config.ConfigService.init_config", lambda: None - ) monkeypatch_session.setattr( "monkey_island.cc.services.database.jsonify", MagicMock(return_value=True) )