diff --git a/monkey/monkey_island/cc/models/__init__.py b/monkey/monkey_island/cc/models/__init__.py index 3b23fa89f..d787a59ef 100644 --- a/monkey/monkey_island/cc/models/__init__.py +++ b/monkey/monkey_island/cc/models/__init__.py @@ -12,6 +12,7 @@ from .monkey import Monkey # noqa: F401, E402 from .monkey_ttl import MonkeyTtl # noqa: F401, E402 from .pba_results import PbaResults # noqa: F401, E402 +# TODO refactor into explicit call when implementing mongodb startup connect( db=env_singleton.env.mongo_db_name, host=env_singleton.env.mongo_db_host, diff --git a/monkey/tests/unit_tests/monkey_island/cc/conftest.py b/monkey/tests/unit_tests/monkey_island/cc/conftest.py index af35c9b25..4bccfd862 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/conftest.py +++ b/monkey/tests/unit_tests/monkey_island/cc/conftest.py @@ -1,3 +1,11 @@ +import monkey_island.cc.environment.environment_singleton as env_singleton +from monkey_island.cc.environment.testing import TestingEnvironment + +# Mock environment singleton because it contains mongodb parameters +# needed for model tests. See monkey/monkey_island/cc/models/__init__.py +env_config = {} +env_singleton.env = TestingEnvironment(env_config) + # Without these imports pytests can't use fixtures, # because they are not found -from tests.unit_tests.monkey_island.cc.mongomock_fixtures import * # noqa: F401,F403 +from tests.unit_tests.monkey_island.cc.mongomock_fixtures import * # noqa: F401,F403,E402