Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ransomware_detection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Held <ilovemilk@wusa.io>2020-12-19 17:45:21 +0300
committerMatthias Held <ilovemilk@wusa.io>2020-12-19 17:45:21 +0300
commitcf02891164debc5cd9d2de6cc909a0fc1e021709 (patch)
tree59b30c4ab900dd18a52817b6178a5073ad70ffda
parent50d2926ce672bf31513b978b9c8059c839e733a9 (diff)
never recover files with an empty path or file name
-rw-r--r--tests/Unit/Controller/FileOperationControllerTest.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/Unit/Controller/FileOperationControllerTest.php b/tests/Unit/Controller/FileOperationControllerTest.php
index 86d351c..af6e28d 100644
--- a/tests/Unit/Controller/FileOperationControllerTest.php
+++ b/tests/Unit/Controller/FileOperationControllerTest.php
@@ -172,9 +172,21 @@ class FileOperationControllerTest extends TestCase
$fileOperationUserFolder->setFileId(3);
$fileOperationUserFolder->setOriginalName('test.jpg');
+ $fileOperationEmptyPath = new FileOperation();
+ $fileOperationEmptyPath->setCommand(Monitor::RENAME);
+ $fileOperationEmptyPath->setFileId(2);
+ $fileOperationEmptyPath->setOriginalName('test.jpg');
+
+ $fileOperationEmptyName= new FileOperation();
+ $fileOperationEmptyName->setCommand(Monitor::RENAME);
+ $fileOperationEmptyName->setPath('/admin/file');
+ $fileOperationEmptyName->setFileId(2);
+
return [
['id' => 4, 'fileOperation' => new FileOperation(), 'deleted' => false, 'response' => Http::STATUS_BAD_REQUEST],
['id' => 3, 'fileOperation' => $fileOperationUserFolder, 'deleted' => false, 'response' => Http::STATUS_BAD_REQUEST],
+ ['id' => 2, 'fileOperation' => $fileOperationEmptyPath, 'deleted' => false, 'response' => Http::STATUS_BAD_REQUEST],
+ ['id' => 2, 'fileOperation' => $fileOperationEmptyName, 'deleted' => false, 'response' => Http::STATUS_BAD_REQUEST],
['id' => 2, 'fileOperation' => $fileOperationRead, 'deleted' => true, 'response' => Http::STATUS_OK],
['id' => 2, 'fileOperation' => $fileOperationRename, 'deleted' => true, 'response' => Http::STATUS_OK],
// needs more mocking