diff --git a/monkey/tests/unit_tests/monkey_island/cc/repository/test_local_storage_file_repository.py b/monkey/tests/unit_tests/monkey_island/cc/repository/test_local_storage_file_repository.py index 64541bcbe..c03d615f9 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/repository/test_local_storage_file_repository.py +++ b/monkey/tests/unit_tests/monkey_island/cc/repository/test_local_storage_file_repository.py @@ -143,3 +143,14 @@ def test_open_locked_file(tmp_path, monkeypatch): with patch("builtins.open", Mock(side_effect=Exception())): with pytest.raises(repository.RetrievalError): fss.open_file("locked_file.txt") + + +def test_delete_files_by_pattern(tmp_path): + for filename in ["xyz-1.txt", "abc-2.txt", "pqr-3.txt", "abc-4.txt"]: + (tmp_path / filename).touch() + + fss = LocalStorageFileRepository(tmp_path) + fss.delete_files_by_pattern("abc-*") + + files = list(tmp_path.iterdir()) + assert len(files) == 2