forked from p15670423/monkey
Island: Remove the Database service's dependency on ConfigService
This commit is contained in:
parent
738d4ef3e1
commit
70b404b9f5
|
@ -6,11 +6,11 @@ from monkey_island.cc.database import mongo
|
||||||
from monkey_island.cc.models import Config
|
from monkey_island.cc.models import Config
|
||||||
from monkey_island.cc.models.agent_controls import AgentControls
|
from monkey_island.cc.models.agent_controls import AgentControls
|
||||||
from monkey_island.cc.models.attack.attack_mitigations import AttackMitigations
|
from monkey_island.cc.models.attack.attack_mitigations import AttackMitigations
|
||||||
from monkey_island.cc.services.config import ConfigService
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
# NOTE: This service is being replaced by the RepositoryService
|
||||||
class Database(object):
|
class Database(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
@ -24,7 +24,6 @@ class Database(object):
|
||||||
for x in mongo.db.collection_names()
|
for x in mongo.db.collection_names()
|
||||||
if Database._should_drop(x, reset_config)
|
if Database._should_drop(x, reset_config)
|
||||||
]
|
]
|
||||||
ConfigService.init_config()
|
|
||||||
Database.init_agent_controls()
|
Database.init_agent_controls()
|
||||||
logger.info("DB was reset")
|
logger.info("DB was reset")
|
||||||
return jsonify(status="OK")
|
return jsonify(status="OK")
|
||||||
|
|
|
@ -19,9 +19,6 @@ def patch_attack_mitigations_path(monkeypatch, data_for_tests_dir):
|
||||||
|
|
||||||
@pytest.fixture(scope="module", autouse=True)
|
@pytest.fixture(scope="module", autouse=True)
|
||||||
def patch_dependencies(monkeypatch_session):
|
def patch_dependencies(monkeypatch_session):
|
||||||
monkeypatch_session.setattr(
|
|
||||||
"monkey_island.cc.services.config.ConfigService.init_config", lambda: None
|
|
||||||
)
|
|
||||||
monkeypatch_session.setattr(
|
monkeypatch_session.setattr(
|
||||||
"monkey_island.cc.services.database.jsonify", MagicMock(return_value=True)
|
"monkey_island.cc.services.database.jsonify", MagicMock(return_value=True)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue