add tests for copy file within shares ucing file-id (#7593)

This commit is contained in:
Nalem7
2023-10-27 15:11:32 +05:45
committed by GitHub
parent 8eb7f7aa96
commit a15fe45d6a
3 changed files with 33 additions and 3 deletions

View File

@@ -178,3 +178,26 @@ Feature: copying file using file id
| dav-path |
| /remote.php/dav/spaces/<<FILEID>> |
| /dav/spaces/<<FILEID>> |
Scenario Outline: copy a file from sub-folder to root folder inside Shares space
Given user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has created folder "/folder"
And user "Alice" has created folder "folder/sub-folder"
And user "Alice" has uploaded file with content "some data" to "/folder/sub-folder/test.txt"
And we save it into "FILEID"
And user "Alice" has shared folder "/folder" with user "Brian" with permissions "all"
When user "Brian" copies a file "Shares/folder/sub-folder/test.txt" into "Shares/folder" inside space "Shares" using file-id path "<dav-path>"
Then the HTTP status code should be "201"
And for user "Brian" folder "folder" of the space "Shares" should contain these files:
| test.txt |
And for user "Brian" folder "folder/sub-folder" of the space "Shares" should contain these files:
| test.txt |
And for user "Alice" folder "folder" of the space "Personal" should contain these files:
| test.txt |
And for user "Alice" folder "folder/sub-folder" of the space "Personal" should contain these files:
| test.txt |
Examples:
| dav-path |
| /remote.php/dav/spaces/<<FILEID>> |
| /dav/spaces/<<FILEID>> |

View File

@@ -610,7 +610,7 @@ class FeatureContext extends BehatVariablesContext {
}
$logMessage = "## $scenario ($scenarioLine)\n";
// Delete previous scenario's log file
if (\file_exists(HttpLogger::getScenarioLogPath())) {
\unlink(HttpLogger::getScenarioLogPath());

View File

@@ -1965,8 +1965,15 @@ class SpacesContext implements Context {
} elseif ($actionType === 'renames') {
$fileDestination = $destinationFile;
}
$headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName, $url);
$fullUrl = $this->featureContext->getBaseUrl() . $url;
$baseUrl = $this->featureContext->getBaseUrl();
if ($toSpaceName === 'Shares') {
$sharesPath = $this->featureContext->getMountSharesPath($user, $fileDestination);
$davPath = WebDavHelper::getDavPath($user, $this->featureContext->getDavPathVersion());
$headers['Destination'] = $baseUrl . $davPath . $sharesPath;
} else {
$headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName, $url);
}
$fullUrl = $baseUrl . $url;
if ($actionType === 'copies') {
$this->featureContext->setResponse($this->copyFilesAndFoldersRequest($user, $fullUrl, $headers));
} elseif ($actionType === 'moves' || $actionType === 'renames') {