Skip to content

Commit

Permalink
add tests for copy file within shares ucing file-id (#7605)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabim777 authored Oct 30, 2023
1 parent 01ccfba commit 804d17c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,27 @@ 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"
And user "Brian" has accepted share "/folder" offered by user "Alice"
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>> |
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public static function logScenario(BeforeScenarioScope $scope): void {
}

$logMessage = "## $scenario ($scenarioLine)\n";

// Delete previous scenario's log file
if (\file_exists(HttpLogger::getScenarioLogPath())) {
\unlink(HttpLogger::getScenarioLogPath());
Expand Down
11 changes: 9 additions & 2 deletions tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1921,8 +1921,15 @@ public function userCopiesOrMovesFileWithFileIdFromAndToSpaceBetweenSpaces(strin
} 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') {
Expand Down

0 comments on commit 804d17c

Please sign in to comment.