From 809b7a437334196d2ce6e511f0645ba2b850e117 Mon Sep 17 00:00:00 2001 From: prashant-gurung899 Date: Thu, 5 Sep 2024 11:33:04 +0545 Subject: [PATCH] add tests to check versions of file in a space shared via link Signed-off-by: prashant-gurung899 --- .../bootstrap/FilesVersionsContext.php | 26 ++++++++++++++++ .../fileVersionByFileID.feature | 31 +++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/tests/acceptance/bootstrap/FilesVersionsContext.php b/tests/acceptance/bootstrap/FilesVersionsContext.php index fb8401fde..198421982 100644 --- a/tests/acceptance/bootstrap/FilesVersionsContext.php +++ b/tests/acceptance/bootstrap/FilesVersionsContext.php @@ -72,6 +72,32 @@ class FilesVersionsContext implements Context { $this->featureContext->setResponse($this->getFileVersions($user, $file)); } + /** + * @When the public tries to get the number of versions of file :file with password :password using file-id path :endpoint + * + * @param string $file + * @param string $password + * @param string $endpoint + * + * @return void + */ + public function thePublicGetsTheNumberOfVersionsOfFileWithPasswordUsingFileIdPath(string $file, string $password, string $endpoint): void { + $password = $this->featureContext->getActualPassword($password); + $this->featureContext->setResponse( + $this->featureContext->makeDavRequest( + "public", + "PROPFIND", + $endpoint, + null, + null, + "versions", + (string)$this->featureContext->getDavPathVersion(), + false, + $password + ) + ); + } + /** * @param string $user * @param string $file diff --git a/tests/acceptance/features/apiSpacesDavOperation/fileVersionByFileID.feature b/tests/acceptance/features/apiSpacesDavOperation/fileVersionByFileID.feature index 3f384d811..c7f3e9690 100644 --- a/tests/acceptance/features/apiSpacesDavOperation/fileVersionByFileID.feature +++ b/tests/acceptance/features/apiSpacesDavOperation/fileVersionByFileID.feature @@ -175,3 +175,34 @@ Feature: checking file versions using file id | permissionsRole | Space Editor Without Versions | When user "Brian" gets the number of versions of file "/text.txt" using file-id path "/meta/<>/v" Then the HTTP status code should be "403" + + + Scenario Outline: public tries to check the versions of a file in a project space shared via link as viewer/editor + Given user "Alice" has created the following space link share: + | space | Project1 | + | permissionsRole | | + | password | %public% | + When the public tries to get the number of versions of file "/text.txt" with password "%public%" using file-id path "/meta/<>/v" + Then the HTTP status code should be "401" + Examples: + | permissions-role | + | view | + | edit | + + + Scenario Outline: public tries to check the versions of a file in a personal space shared via link as viewer/editor + Given user "Alice" has created folder "PARENT" + And user "Alice" has uploaded file with content "some data" to "/PARENT/parent.txt" + And user "Alice" has uploaded file with content "some updated data" to "/PARENT/parent.txt" + And we save it into "FILEID" + And user "Alice" has created the following resource link share: + | resource | PARENT | + | space | Personal | + | permissionsRole | | + | password | %public% | + When the public tries to get the number of versions of file "/parent.txt" with password "%public%" using file-id path "/meta/<>/v" + Then the HTTP status code should be "401" + Examples: + | permissions-role | + | view | + | edit |