From 80050b89e650512b8916b096e967b553b3596f3b Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 9 Jul 2021 11:23:22 +0200 Subject: [PATCH] Island: Add unit test leaving no readme if no target dir --- .../ransomware/test_ransomware_payload.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 8a08a4595..37af9509e 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 @@ -244,3 +244,16 @@ def test_readme_already_exists( ).run_payload() mock_copy_file.assert_not_called() + + +def test_no_readme_if_no_directory( + build_ransomware_payload, ransomware_payload_config, ransomware_target +): + ransomware_payload_config["encryption"]["enabled"] = True + ransomware_payload_config["encryption"]["directories"]["linux_target_dir"] = "" + ransomware_payload_config["encryption"]["directories"]["windows_target_dir"] = "" + ransomware_payload_config["other_behaviors"]["readme"] = True + ransomware_payload = build_ransomware_payload(ransomware_payload_config) + + ransomware_payload.run_payload() + assert not Path(ransomware_target / README_DEST).exists()