diff --git a/monkey/tests/conftest.py b/monkey/tests/conftest.py index 4cf7471f5..b0e9e9c2e 100644 --- a/monkey/tests/conftest.py +++ b/monkey/tests/conftest.py @@ -9,8 +9,8 @@ sys.path.insert(0, MONKEY_BASE_PATH) @pytest.fixture(scope="session") -def mocked_data_dir(pytestconfig): - return os.path.join(pytestconfig.rootdir, "monkey", "tests", "mocked_data") +def data_for_tests_dir(pytestconfig): + return os.path.join(pytestconfig.rootdir, "monkey", "tests", "data_for_tests") @pytest.fixture diff --git a/monkey/tests/mocked_data/logger_config.json b/monkey/tests/data_for_tests/logger_config.json similarity index 100% rename from monkey/tests/mocked_data/logger_config.json rename to monkey/tests/data_for_tests/logger_config.json diff --git a/monkey/tests/mocked_data/mongo_key.bin b/monkey/tests/data_for_tests/mongo_key.bin similarity index 100% rename from monkey/tests/mocked_data/mongo_key.bin rename to monkey/tests/data_for_tests/mongo_key.bin diff --git a/monkey/tests/mocked_data/server_configs/server_config_no_credentials.json b/monkey/tests/data_for_tests/server_configs/server_config_no_credentials.json similarity index 100% rename from monkey/tests/mocked_data/server_configs/server_config_no_credentials.json rename to monkey/tests/data_for_tests/server_configs/server_config_no_credentials.json diff --git a/monkey/tests/mocked_data/server_configs/server_config_partial_credentials.json b/monkey/tests/data_for_tests/server_configs/server_config_partial_credentials.json similarity index 100% rename from monkey/tests/mocked_data/server_configs/server_config_partial_credentials.json rename to monkey/tests/data_for_tests/server_configs/server_config_partial_credentials.json diff --git a/monkey/tests/mocked_data/server_configs/server_config_standard_env.json b/monkey/tests/data_for_tests/server_configs/server_config_standard_env.json similarity index 100% rename from monkey/tests/mocked_data/server_configs/server_config_standard_env.json rename to monkey/tests/data_for_tests/server_configs/server_config_standard_env.json diff --git a/monkey/tests/mocked_data/server_configs/server_config_standard_with_credentials.json b/monkey/tests/data_for_tests/server_configs/server_config_standard_with_credentials.json similarity index 100% rename from monkey/tests/mocked_data/server_configs/server_config_standard_with_credentials.json rename to monkey/tests/data_for_tests/server_configs/server_config_standard_with_credentials.json diff --git a/monkey/tests/mocked_data/server_configs/server_config_with_credentials.json b/monkey/tests/data_for_tests/server_configs/server_config_with_credentials.json similarity index 100% rename from monkey/tests/mocked_data/server_configs/server_config_with_credentials.json rename to monkey/tests/data_for_tests/server_configs/server_config_with_credentials.json diff --git a/monkey/tests/mocked_data/server_configs/test_server_config.json b/monkey/tests/data_for_tests/server_configs/test_server_config.json similarity index 100% rename from monkey/tests/mocked_data/server_configs/test_server_config.json rename to monkey/tests/data_for_tests/server_configs/test_server_config.json diff --git a/monkey/tests/monkey_island/cc/environment/conftest.py b/monkey/tests/monkey_island/cc/environment/conftest.py index 0450437a1..767f765d9 100644 --- a/monkey/tests/monkey_island/cc/environment/conftest.py +++ b/monkey/tests/monkey_island/cc/environment/conftest.py @@ -4,20 +4,20 @@ import pytest @pytest.fixture(scope="module") -def with_credentials(mocked_server_configs_dir): - return os.path.join(mocked_server_configs_dir, "server_config_with_credentials.json") +def with_credentials(server_configs_dir): + return os.path.join(server_configs_dir, "server_config_with_credentials.json") @pytest.fixture(scope="module") -def no_credentials(mocked_server_configs_dir): - return os.path.join(mocked_server_configs_dir, "server_config_no_credentials.json") +def no_credentials(server_configs_dir): + return os.path.join(server_configs_dir, "server_config_no_credentials.json") @pytest.fixture(scope="module") -def partial_credentials(mocked_server_configs_dir): - return os.path.join(mocked_server_configs_dir, "server_config_partial_credentials.json") +def partial_credentials(server_configs_dir): + return os.path.join(server_configs_dir, "server_config_partial_credentials.json") @pytest.fixture(scope="module") -def standard_with_credentials(mocked_server_configs_dir): - return os.path.join(mocked_server_configs_dir, "server_config_standard_with_credentials.json") +def standard_with_credentials(server_configs_dir): + return os.path.join(server_configs_dir, "server_config_standard_with_credentials.json") diff --git a/monkey/tests/monkey_island/cc/environment/test_environment.py b/monkey/tests/monkey_island/cc/environment/test_environment.py index 3b0c2c713..030f99169 100644 --- a/monkey/tests/monkey_island/cc/environment/test_environment.py +++ b/monkey/tests/monkey_island/cc/environment/test_environment.py @@ -27,24 +27,20 @@ FULL_USER_CREDENTIALS = UserCreds(username="test", password_hash="1231234") # This fixture is a dirty hack that can be removed once these tests are converted from # unittest to pytest. Instead, the appropriate fixtures from conftest.py can be used. @pytest.fixture(scope="module", autouse=True) -def configure_resources(mocked_server_configs_dir): +def configure_resources(server_configs_dir): global WITH_CREDENTIALS global NO_CREDENTIALS global PARTIAL_CREDENTIALS global STANDARD_WITH_CREDENTIALS global STANDARD_ENV - WITH_CREDENTIALS = os.path.join( - mocked_server_configs_dir, "server_config_with_credentials.json" - ) - NO_CREDENTIALS = os.path.join(mocked_server_configs_dir, "server_config_no_credentials.json") - PARTIAL_CREDENTIALS = os.path.join( - mocked_server_configs_dir, "server_config_partial_credentials.json" - ) + WITH_CREDENTIALS = os.path.join(server_configs_dir, "server_config_with_credentials.json") + NO_CREDENTIALS = os.path.join(server_configs_dir, "server_config_no_credentials.json") + PARTIAL_CREDENTIALS = os.path.join(server_configs_dir, "server_config_partial_credentials.json") STANDARD_WITH_CREDENTIALS = os.path.join( - mocked_server_configs_dir, "server_config_standard_with_credentials.json" + server_configs_dir, "server_config_standard_with_credentials.json" ) - STANDARD_ENV = os.path.join(mocked_server_configs_dir, "server_config_standard_env.json") + STANDARD_ENV = os.path.join(server_configs_dir, "server_config_standard_env.json") def get_tmp_file(): diff --git a/monkey/tests/monkey_island/cc/test_encryptor.py b/monkey/tests/monkey_island/cc/test_encryptor.py index b92b6cf11..0ca724d44 100644 --- a/monkey/tests/monkey_island/cc/test_encryptor.py +++ b/monkey/tests/monkey_island/cc/test_encryptor.py @@ -8,20 +8,20 @@ PLAINTEXT = "Hello, Monkey!" CYPHERTEXT = "vKgvD6SjRyIh1dh2AM/rnTa0NI/vjfwnbZLbMocWtE4e42WJmSUz2ordtbQrH1Fq" -def test_aes_cbc_encryption(mocked_data_dir): - initialize_encryptor(mocked_data_dir) +def test_aes_cbc_encryption(data_for_tests_dir): + initialize_encryptor(data_for_tests_dir) assert get_encryptor().enc(PLAINTEXT) != PLAINTEXT -def test_aes_cbc_decryption(mocked_data_dir): - initialize_encryptor(mocked_data_dir) +def test_aes_cbc_decryption(data_for_tests_dir): + initialize_encryptor(data_for_tests_dir) assert get_encryptor().dec(CYPHERTEXT) == PLAINTEXT -def test_aes_cbc_enc_dec(mocked_data_dir): - initialize_encryptor(mocked_data_dir) +def test_aes_cbc_enc_dec(data_for_tests_dir): + initialize_encryptor(data_for_tests_dir) assert get_encryptor().dec(get_encryptor().enc(PLAINTEXT)) == PLAINTEXT diff --git a/monkey/tests/monkey_island/conftest.py b/monkey/tests/monkey_island/conftest.py index 589f3f20c..4b7149595 100644 --- a/monkey/tests/monkey_island/conftest.py +++ b/monkey/tests/monkey_island/conftest.py @@ -4,10 +4,10 @@ import pytest @pytest.fixture(scope="module") -def mocked_server_configs_dir(mocked_data_dir): - return os.path.join(mocked_data_dir, "server_configs") +def server_configs_dir(data_for_tests_dir): + return os.path.join(data_for_tests_dir, "server_configs") @pytest.fixture(scope="module") -def test_server_config(mocked_server_configs_dir): - return os.path.join(mocked_server_configs_dir, "test_server_config.json") +def test_server_config(server_configs_dir): + return os.path.join(server_configs_dir, "test_server_config.json")