Merge pull request #1305 from guardicore/ransomware-skip-encryption-test-refactor

Island: Refactor test_encryption_skipped_if_no_directory()
This commit is contained in:
Mike Salvatore 2021-07-08 06:37:49 -04:00 committed by GitHub
commit e1b08079f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 7 deletions

View File

@ -170,15 +170,9 @@ def test_encryption_skipped_if_no_directory(
ransomware_payload_config["encryption"]["directories"]["linux_target_dir"] = ""
ransomware_payload_config["encryption"]["directories"]["windows_target_dir"] = ""
def _file_encryption_method_mock(*args, **kwargs):
raise Exception(
"Ransomware payload attempted to "
"encrypt files even though no directory was provided!"
)
ransomware_payload = RansomwarePayload(ransomware_payload_config, telemetry_messenger_spy)
monkeypatch.setattr(ransomware_payload, "_encrypt_files", _file_encryption_method_mock)
ransomware_payload.run_payload()
assert len(telemetry_messenger_spy.telemetries) == 0
def test_telemetry_success(ransomware_payload, telemetry_messenger_spy):