Create default server_config.json when running unit tests

This commit is contained in:
Shreya 2021-05-21 20:09:17 +05:30
parent 23b04920b2
commit 43d919a3eb
1 changed files with 15 additions and 7 deletions

View File

@ -1,16 +1,24 @@
from mongoengine import connect from mongoengine import connect
import monkey_island.cc.environment.environment_singleton as env_singleton # Needed so that a server_config.json file exists at the default path,
# otherwise, unit tests will error while importing `env_singleton` below.
from monkey_island.cc.environment.server_config_generator import ( # noqa: E402
create_default_server_config_file,
)
from .command_control_channel import CommandControlChannel # noqa: F401 create_default_server_config_file()
import monkey_island.cc.environment.environment_singleton as env_singleton # noqa: E402
from .command_control_channel import CommandControlChannel # noqa: F401, E402
# Order of importing matters here, for registering the embedded and referenced documents before # Order of importing matters here, for registering the embedded and referenced documents before
# using them. # using them.
from .config import Config # noqa: F401 from .config import Config # noqa: F401, E402
from .creds import Creds # noqa: F401 from .creds import Creds # noqa: F401, E402
from .monkey import Monkey # noqa: F401 from .monkey import Monkey # noqa: F401, E402
from .monkey_ttl import MonkeyTtl # noqa: F401 from .monkey_ttl import MonkeyTtl # noqa: F401, E402
from .pba_results import PbaResults # noqa: F401 from .pba_results import PbaResults # noqa: F401, E402
connect( connect(
db=env_singleton.env.mongo_db_name, db=env_singleton.env.mongo_db_name,