forked from p15670423/monkey
island: Remove redundant "test_island_config_options" from tests
The file is named "test_island_config_options.py". Including "island_config_options" in every test/function name is reduntant.
This commit is contained in:
parent
ea0d6f0141
commit
f2a2efc2a7
|
@ -18,30 +18,28 @@ TEST_CONFIG_FILE_CONTENTS_UNSPECIFIED = {}
|
||||||
TEST_CONFIG_FILE_CONTENTS_NO_STARTMONGO = {"mongodb": {}}
|
TEST_CONFIG_FILE_CONTENTS_NO_STARTMONGO = {"mongodb": {}}
|
||||||
|
|
||||||
|
|
||||||
def test_island_config_options__data_dir_specified():
|
def test_data_dir_specified():
|
||||||
assert_island_config_options_data_dir_equals(TEST_CONFIG_FILE_CONTENTS_SPECIFIED, "/tmp")
|
assert_data_dir_equals(TEST_CONFIG_FILE_CONTENTS_SPECIFIED, "/tmp")
|
||||||
|
|
||||||
|
|
||||||
def test_island_config_options__data_dir_uses_default():
|
def test_data_dir_uses_default():
|
||||||
assert_island_config_options_data_dir_equals(
|
assert_data_dir_equals(TEST_CONFIG_FILE_CONTENTS_UNSPECIFIED, DEFAULT_DATA_DIR)
|
||||||
TEST_CONFIG_FILE_CONTENTS_UNSPECIFIED, DEFAULT_DATA_DIR
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_island_config_options__data_dir_expanduser(monkeypatch, tmpdir):
|
def test_data_dir_expanduser(monkeypatch, tmpdir):
|
||||||
set_home_env(monkeypatch, tmpdir)
|
set_home_env(monkeypatch, tmpdir)
|
||||||
DATA_DIR_NAME = "test_data_dir"
|
DATA_DIR_NAME = "test_data_dir"
|
||||||
|
|
||||||
assert_island_config_options_data_dir_equals(
|
assert_data_dir_equals(
|
||||||
{"data_dir": os.path.join("~", DATA_DIR_NAME)}, os.path.join(tmpdir, DATA_DIR_NAME)
|
{"data_dir": os.path.join("~", DATA_DIR_NAME)}, os.path.join(tmpdir, DATA_DIR_NAME)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_island_config_options__data_dir_expandvars(monkeypatch, tmpdir):
|
def test_data_dir_expandvars(monkeypatch, tmpdir):
|
||||||
set_home_env(monkeypatch, tmpdir)
|
set_home_env(monkeypatch, tmpdir)
|
||||||
DATA_DIR_NAME = "test_data_dir"
|
DATA_DIR_NAME = "test_data_dir"
|
||||||
|
|
||||||
assert_island_config_options_data_dir_equals(
|
assert_data_dir_equals(
|
||||||
{"data_dir": os.path.join("$HOME", DATA_DIR_NAME)}, os.path.join(tmpdir, DATA_DIR_NAME)
|
{"data_dir": os.path.join("$HOME", DATA_DIR_NAME)}, os.path.join(tmpdir, DATA_DIR_NAME)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -50,26 +48,26 @@ def set_home_env(monkeypatch, tmpdir):
|
||||||
monkeypatch.setenv("HOME", str(tmpdir))
|
monkeypatch.setenv("HOME", str(tmpdir))
|
||||||
|
|
||||||
|
|
||||||
def assert_island_config_options_data_dir_equals(config_file_contents, expected_data_dir):
|
def assert_data_dir_equals(config_file_contents, expected_data_dir):
|
||||||
assert_island_config_option_equals(config_file_contents, "data_dir", expected_data_dir)
|
assert_island_config_option_equals(config_file_contents, "data_dir", expected_data_dir)
|
||||||
|
|
||||||
|
|
||||||
def assert_island_config_option_equals(config_file_contents, option_name, expected_value):
|
def test_log_level():
|
||||||
options = IslandConfigOptions(config_file_contents)
|
|
||||||
assert getattr(options, option_name) == expected_value
|
|
||||||
|
|
||||||
|
|
||||||
def test_island_config_options__log_level():
|
|
||||||
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_SPECIFIED)
|
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_SPECIFIED)
|
||||||
assert options.log_level == "test"
|
assert options.log_level == "test"
|
||||||
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_UNSPECIFIED)
|
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_UNSPECIFIED)
|
||||||
assert options.log_level == DEFAULT_LOG_LEVEL
|
assert options.log_level == DEFAULT_LOG_LEVEL
|
||||||
|
|
||||||
|
|
||||||
def test_island_config_options__mongodb():
|
def test_mongodb():
|
||||||
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_SPECIFIED)
|
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_SPECIFIED)
|
||||||
assert not options.start_mongodb
|
assert not options.start_mongodb
|
||||||
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_UNSPECIFIED)
|
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_UNSPECIFIED)
|
||||||
assert options.start_mongodb == DEFAULT_START_MONGO_DB
|
assert options.start_mongodb == DEFAULT_START_MONGO_DB
|
||||||
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_NO_STARTMONGO)
|
options = IslandConfigOptions(TEST_CONFIG_FILE_CONTENTS_NO_STARTMONGO)
|
||||||
assert options.start_mongodb == DEFAULT_START_MONGO_DB
|
assert options.start_mongodb == DEFAULT_START_MONGO_DB
|
||||||
|
|
||||||
|
|
||||||
|
def assert_island_config_option_equals(config_file_contents, option_name, expected_value):
|
||||||
|
options = IslandConfigOptions(config_file_contents)
|
||||||
|
assert getattr(options, option_name) == expected_value
|
||||||
|
|
Loading…
Reference in New Issue