Improved the readability IslandConfigOptions test

This commit is contained in:
VakarisZ 2021-05-24 14:03:49 +03:00
parent 2afdfa297b
commit d52e80a3f3
1 changed files with 4 additions and 6 deletions

View File

@ -1,20 +1,18 @@
from monkey_island.cc.server_utils.consts import DEFAULT_LOG_LEVEL, DEFAULT_START_MONGO_DB
from monkey_island.setup.island_config_options import IslandConfigOptions
MOCKED_CONFIG_FILE_CONTENTS_STANDARD = {"data_dir": "/tmp", "mongodb": {"start_mongodb": False}}
TEST_CONFIG_FILE_CONTENTS_STANDARD = {"data_dir": "/tmp", "mongodb": {"start_mongodb": False}}
MOCKED_CONFIG_FILE_CONTENTS_NO_STARTMONGO = {"data_dir": "/tmp", "mongodb": {}}
TEST_CONFIG_FILE_CONTENTS_NO_STARTMONGO = {"data_dir": "/tmp", "mongodb": {}}
def test_island_config_options__standard():
options = IslandConfigOptions(MOCKED_CONFIG_FILE_CONTENTS_STANDARD)
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_STANDARD)
assert not options.start_mongodb
assert options.data_dir == "/tmp"
assert options.log_level == DEFAULT_LOG_LEVEL
def test_island_config_options__no_starmongo():
options = IslandConfigOptions(MOCKED_CONFIG_FILE_CONTENTS_NO_STARTMONGO)
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_NO_STARTMONGO)
assert options.start_mongodb == DEFAULT_START_MONGO_DB
assert options.data_dir == "/tmp"
assert options.log_level == DEFAULT_LOG_LEVEL