From 610731f4937446dc9bb07c216e7f06e3a75c52b3 Mon Sep 17 00:00:00 2001 From: prashant-gurung899 Date: Wed, 7 Aug 2024 14:08:31 +0545 Subject: [PATCH] add test to delete file by id Signed-off-by: prashant-gurung899 --- .../acceptance/features/bootstrap/WebDav.php | 25 +++++++++++++++++++ .../coreApiWebdavDelete/deleteFile.feature | 13 ++++++++++ 2 files changed, 38 insertions(+) diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index ed1d2a0850b..d7241be09d0 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -2700,6 +2700,31 @@ public function userDeletesFile(string $user, string $resource):void { $this->pushToLastStatusCodesArrays(); } + /** + * @When user :user deletes file :filename from space :space using file-id path :davPath + * + * @param string $user + * @param string $filename + * @param string $space + * @param string $davPath + * + * @return void + */ + public function userDeletesFileFromSpaceUsingFileIdPath(string $user, string $filename, string $space, string $davPath):void { + $requestUrl = $this->getBaseUrl() . $davPath; + $user = $this->getActualUsername($user); + $password = $this->getPasswordForUser($user); + $response = HttpRequestHelper::sendRequest( + $requestUrl, + null, + 'DELETE', + $user, + $password + ); + $this->setResponse($response); + $this->pushToLastStatusCodesArrays(); + } + /** * @Given /^user "([^"]*)" has deleted (?:file|folder|entity) "([^"]*)"$/ * diff --git a/tests/acceptance/features/coreApiWebdavDelete/deleteFile.feature b/tests/acceptance/features/coreApiWebdavDelete/deleteFile.feature index 397870c778e..b98723068bb 100644 --- a/tests/acceptance/features/coreApiWebdavDelete/deleteFile.feature +++ b/tests/acceptance/features/coreApiWebdavDelete/deleteFile.feature @@ -137,3 +137,16 @@ Feature: delete file When user "Alice" deletes file "/zerobyte.txt" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" file "/zerobyte.txt" should not exist + + @issue-9619 + Scenario Outline: delete a file using file-id + Given using spaces DAV path + And user "Alice" has uploaded file with content "special file" to "/textfile.txt" + And we save it into "FILEID" + When user "Alice" deletes file "/textfile.txt" from space "Personal" using file-id path "" + Then the HTTP status code should be "204" + And as "Alice" file "/textfile.txt" should not exist + Examples: + | dav-path | + | /remote.php/dav/spaces/<> | + | /dav/spaces/<> |