From d99811f83fc1da756e8c21be03625d76a2554f31 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 23 Jun 2021 09:04:24 -0400 Subject: [PATCH] tests: Move ransomware_target() fixture to ransomware/conftest.py --- .../infection_monkey/ransomware/conftest.py | 13 +++++++++++++ .../ransomware/test_ransomware_payload.py | 11 ----------- 2 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 monkey/tests/unit_tests/infection_monkey/ransomware/conftest.py diff --git a/monkey/tests/unit_tests/infection_monkey/ransomware/conftest.py b/monkey/tests/unit_tests/infection_monkey/ransomware/conftest.py new file mode 100644 index 000000000..60b14a322 --- /dev/null +++ b/monkey/tests/unit_tests/infection_monkey/ransomware/conftest.py @@ -0,0 +1,13 @@ +import shutil +from pathlib import Path + +import pytest + + +@pytest.fixture +def ransomware_target(tmp_path, data_for_tests_dir): + ransomware_test_data = Path(data_for_tests_dir) / "ransomware_targets" + ransomware_target = tmp_path / "ransomware_target" + shutil.copytree(ransomware_test_data, ransomware_target) + + return ransomware_target diff --git a/monkey/tests/unit_tests/infection_monkey/ransomware/test_ransomware_payload.py b/monkey/tests/unit_tests/infection_monkey/ransomware/test_ransomware_payload.py index df62af6ac..705b10ed5 100644 --- a/monkey/tests/unit_tests/infection_monkey/ransomware/test_ransomware_payload.py +++ b/monkey/tests/unit_tests/infection_monkey/ransomware/test_ransomware_payload.py @@ -1,6 +1,4 @@ import os -import shutil -from pathlib import Path import pytest from tests.utils import hash_file, is_user_admin @@ -36,15 +34,6 @@ def with_extension(filename): return f"{filename}{EXTENSION}" -@pytest.fixture -def ransomware_target(tmp_path, data_for_tests_dir): - ransomware_test_data = Path(data_for_tests_dir) / "ransomware_targets" - ransomware_target = tmp_path / "ransomware_target" - shutil.copytree(ransomware_test_data, ransomware_target) - - return ransomware_target - - @pytest.fixture def ransomware_payload_config(ransomware_target): return {"linux_dir": str(ransomware_target), "windows_dir": str(ransomware_target)}