mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-31 09:20:15 -06:00
remove unused index paramater
Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
@@ -60,7 +60,10 @@ Feature: Download file in project space
|
||||
| Brian |
|
||||
|
||||
|
||||
Scenario: user with role viewer cannot get the old version of the file in the project space
|
||||
Scenario: user with role viewer cannot get versions of a file in the project space
|
||||
Given user "Alice" has uploaded a file inside space "download file" with content "new content" to "file.txt"
|
||||
When user "Bob" tries to get version of the file "file.txt" with the index "1" of the space "download file" using the WebDAV API
|
||||
And user "Alice" has uploaded a file inside space "download file" with content "newest content" to "file.txt"
|
||||
When user "Bob" tries to get versions of the file "file.txt" from the space "download file" using the WebDAV API
|
||||
Then the HTTP status code should be "403"
|
||||
When user "Bob" tries to download version of the file "file.txt" with the index "1" of the space "download file" using the WebDAV API
|
||||
Then the HTTP status code should be "403"
|
||||
|
||||
@@ -10,11 +10,10 @@ Feature: an user shares resources usin ScienceMesh application
|
||||
And user "Brian" has been created with default attributes and without skeleton files
|
||||
|
||||
|
||||
Scenario: user generates invitation
|
||||
Scenario: user generates invitation
|
||||
Given using server "LOCAL"
|
||||
When "Alice" generates invitation
|
||||
Then the HTTP status code should be "200"
|
||||
When using server "REMOTE"
|
||||
And "Brian" accepts invitation
|
||||
Then the HTTP status code should be "200"
|
||||
|
||||
@@ -59,7 +59,7 @@ Feature: change shared resource
|
||||
When user "Alice" downloads version of the file "/textfile1.txt" with the index "1" of the space "Personal" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
And the downloaded content should be "old content version 2"
|
||||
When user "Brian" tries to get version of the file "/textfile1.txt" with the index "1" of the space "Shares" using the WebDAV API
|
||||
When user "Brian" tries to get versions of the file "/textfile1.txt" from the space "Shares" using the WebDAV API
|
||||
Then the HTTP status code should be "403"
|
||||
Examples:
|
||||
| user-role |
|
||||
|
||||
@@ -178,7 +178,11 @@ class FilesVersionsContext implements Context {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||
Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)");
|
||||
$responseXml = $this->listVersionFolder($user, $fileId, 1);
|
||||
$response = $this->listVersionFolder($user, $fileId, 1);
|
||||
$responseXml = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
);
|
||||
$xmlPart = $responseXml->xpath("//d:response/d:href");
|
||||
//restoring the version only works with DAV path v2
|
||||
$destinationUrl = $this->featureContext->getBaseUrl() . "/" .
|
||||
@@ -236,7 +240,11 @@ class FilesVersionsContext implements Context {
|
||||
* @throws Exception
|
||||
*/
|
||||
public function assertFileVersionsCount(string $user, string $fileId, int $expectedCount):void {
|
||||
$responseXml = $this->listVersionFolder($user, $fileId, 1);
|
||||
$response = $this->listVersionFolder($user, $fileId, 1);
|
||||
$responseXml = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
);
|
||||
$actualCount = \count($responseXml->xpath("//d:prop/d:getetag")) - 1;
|
||||
if ($actualCount === -1) {
|
||||
$actualCount = 0;
|
||||
@@ -307,11 +315,10 @@ class FilesVersionsContext implements Context {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||
Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)");
|
||||
$responseXml = $this->listVersionFolder(
|
||||
$user,
|
||||
$fileId,
|
||||
1,
|
||||
['getcontentlength']
|
||||
$response = $this->listVersionFolder($user, $fileId, 1, ['getcontentlength']);
|
||||
$responseXml = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
);
|
||||
$xmlPart = $responseXml->xpath("//d:prop/d:getcontentlength");
|
||||
Assert::assertEquals(
|
||||
@@ -370,7 +377,11 @@ class FilesVersionsContext implements Context {
|
||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||
Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)");
|
||||
$index = (int)$index;
|
||||
$responseXml = $this->listVersionFolder($user, $fileId, 1);
|
||||
$response = $this->listVersionFolder($user, $fileId, 1);
|
||||
if ($response->getStatusCode() === 403) {
|
||||
return $response;
|
||||
}
|
||||
$responseXml = new SimpleXMLElement($response->getBody()->getContents());
|
||||
$xmlPart = $responseXml->xpath("//d:response/d:href");
|
||||
if (!isset($xmlPart[$index])) {
|
||||
Assert::fail(
|
||||
@@ -482,7 +493,7 @@ class FilesVersionsContext implements Context {
|
||||
* @param int $folderDepth
|
||||
* @param string[]|null $properties
|
||||
*
|
||||
* @return SimpleXMLElement
|
||||
* @return ResponseInterface
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listVersionFolder(
|
||||
@@ -490,7 +501,7 @@ class FilesVersionsContext implements Context {
|
||||
string $fileId,
|
||||
int $folderDepth,
|
||||
?array $properties = null
|
||||
):SimpleXMLElement {
|
||||
):ResponseInterface {
|
||||
if (!$properties) {
|
||||
$properties = [
|
||||
'getetag'
|
||||
@@ -508,10 +519,7 @@ class FilesVersionsContext implements Context {
|
||||
(string) $folderDepth,
|
||||
"versions"
|
||||
);
|
||||
return HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3150,6 +3150,7 @@ class SpacesContext implements Context {
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" downloads version of the file "([^"]*)" with the index "([^"]*)" of the space "([^"]*)" using the WebDAV API$/
|
||||
* @When /^user "([^"]*)" tries to download version of the file "([^"]*)" with the index "([^"]*)" of the space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileName
|
||||
@@ -3171,17 +3172,16 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" tries to get version of the file "([^"]*)" with the index "([^"]*)" of the space "([^"]*)" using the WebDAV API$/
|
||||
* @When user :user tries to get versions of the file :file from the space :space using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
* @param string $index
|
||||
* @param string $spaceName
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userTriesToDownloadFileVersions(string $user, string $file, string $index, string $spaceName):void {
|
||||
public function userTriesToDownloadFileVersions(string $user, string $file, string $spaceName):void {
|
||||
$this->setSpaceIDByName($user, $spaceName);
|
||||
$this->featureContext->setResponse(
|
||||
$this->filesVersionsContext->getFileVersions($user, $file)
|
||||
|
||||
Reference in New Issue
Block a user