add tests to check versions of file in a space shared via link

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899
2024-09-05 11:33:04 +05:45
parent e224264d9e
commit 809b7a4373
2 changed files with 57 additions and 0 deletions

View File

@@ -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

View File

@@ -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/<<FILEID>>/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 | <permissions-role> |
| password | %public% |
When the public tries to get the number of versions of file "/text.txt" with password "%public%" using file-id path "/meta/<<FILEID>>/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 | <permissions-role> |
| password | %public% |
When the public tries to get the number of versions of file "/parent.txt" with password "%public%" using file-id path "/meta/<<FILEID>>/v"
Then the HTTP status code should be "401"
Examples:
| permissions-role |
| view |
| edit |