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 |
|
| 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"
|
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"
|
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
|
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"
|
Given using server "LOCAL"
|
||||||
When "Alice" generates invitation
|
When "Alice" generates invitation
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
When using server "REMOTE"
|
When using server "REMOTE"
|
||||||
And "Brian" accepts invitation
|
And "Brian" accepts invitation
|
||||||
Then the HTTP status code should be "200"
|
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
|
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"
|
Then the HTTP status code should be "200"
|
||||||
And the downloaded content should be "old content version 2"
|
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"
|
Then the HTTP status code should be "403"
|
||||||
Examples:
|
Examples:
|
||||||
| user-role |
|
| user-role |
|
||||||
|
|||||||
@@ -178,7 +178,11 @@ class FilesVersionsContext implements Context {
|
|||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||||
Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)");
|
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");
|
$xmlPart = $responseXml->xpath("//d:response/d:href");
|
||||||
//restoring the version only works with DAV path v2
|
//restoring the version only works with DAV path v2
|
||||||
$destinationUrl = $this->featureContext->getBaseUrl() . "/" .
|
$destinationUrl = $this->featureContext->getBaseUrl() . "/" .
|
||||||
@@ -236,7 +240,11 @@ class FilesVersionsContext implements Context {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function assertFileVersionsCount(string $user, string $fileId, int $expectedCount):void {
|
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;
|
$actualCount = \count($responseXml->xpath("//d:prop/d:getetag")) - 1;
|
||||||
if ($actualCount === -1) {
|
if ($actualCount === -1) {
|
||||||
$actualCount = 0;
|
$actualCount = 0;
|
||||||
@@ -307,11 +315,10 @@ class FilesVersionsContext implements Context {
|
|||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||||
Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)");
|
Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)");
|
||||||
$responseXml = $this->listVersionFolder(
|
$response = $this->listVersionFolder($user, $fileId, 1, ['getcontentlength']);
|
||||||
$user,
|
$responseXml = HttpRequestHelper::getResponseXml(
|
||||||
$fileId,
|
$response,
|
||||||
1,
|
__METHOD__
|
||||||
['getcontentlength']
|
|
||||||
);
|
);
|
||||||
$xmlPart = $responseXml->xpath("//d:prop/d:getcontentlength");
|
$xmlPart = $responseXml->xpath("//d:prop/d:getcontentlength");
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
@@ -370,7 +377,11 @@ class FilesVersionsContext implements Context {
|
|||||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||||
Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)");
|
Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)");
|
||||||
$index = (int)$index;
|
$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");
|
$xmlPart = $responseXml->xpath("//d:response/d:href");
|
||||||
if (!isset($xmlPart[$index])) {
|
if (!isset($xmlPart[$index])) {
|
||||||
Assert::fail(
|
Assert::fail(
|
||||||
@@ -482,7 +493,7 @@ class FilesVersionsContext implements Context {
|
|||||||
* @param int $folderDepth
|
* @param int $folderDepth
|
||||||
* @param string[]|null $properties
|
* @param string[]|null $properties
|
||||||
*
|
*
|
||||||
* @return SimpleXMLElement
|
* @return ResponseInterface
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function listVersionFolder(
|
public function listVersionFolder(
|
||||||
@@ -490,7 +501,7 @@ class FilesVersionsContext implements Context {
|
|||||||
string $fileId,
|
string $fileId,
|
||||||
int $folderDepth,
|
int $folderDepth,
|
||||||
?array $properties = null
|
?array $properties = null
|
||||||
):SimpleXMLElement {
|
):ResponseInterface {
|
||||||
if (!$properties) {
|
if (!$properties) {
|
||||||
$properties = [
|
$properties = [
|
||||||
'getetag'
|
'getetag'
|
||||||
@@ -508,10 +519,7 @@ class FilesVersionsContext implements Context {
|
|||||||
(string) $folderDepth,
|
(string) $folderDepth,
|
||||||
"versions"
|
"versions"
|
||||||
);
|
);
|
||||||
return HttpRequestHelper::getResponseXml(
|
return $response;
|
||||||
$response,
|
|
||||||
__METHOD__
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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 "([^"]*)" 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 $user
|
||||||
* @param string $fileName
|
* @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 $user
|
||||||
* @param string $file
|
* @param string $file
|
||||||
* @param string $index
|
|
||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @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->setSpaceIDByName($user, $spaceName);
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->filesVersionsContext->getFileVersions($user, $file)
|
$this->filesVersionsContext->getFileVersions($user, $file)
|
||||||
|
|||||||
Reference in New Issue
Block a user