test: fix MOVE within Shares tests
This commit is contained in:
@@ -560,10 +560,18 @@ trait WebDav {
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function destinationHeaderValue(string $user, string $fileDestination):string {
|
||||
$fileDestination = \ltrim($fileDestination, "/");
|
||||
$spaceId = $this->getPersonalSpaceIdForUser($user);
|
||||
// If the destination is a share, we need to get the space ID for the Shares space
|
||||
if (\str_starts_with($fileDestination, "Shares/")) {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, "Shares");
|
||||
if ($this->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES) {
|
||||
$fileDestination = \preg_replace("/^Shares\//", "", $fileDestination);
|
||||
}
|
||||
}
|
||||
$fullUrl = $this->getBaseUrl() . '/' .
|
||||
WebDavHelper::getDavPath($user, $this->getDavPathVersion(), "files", $spaceId);
|
||||
return \rtrim($fullUrl, '/') . '/' . \ltrim($fileDestination, '/');
|
||||
return \rtrim($fullUrl, '/') . '/' . $fileDestination;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -580,17 +588,7 @@ trait WebDav {
|
||||
?string $fileSource,
|
||||
?string $fileDestination
|
||||
):void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$headers['Destination'] = $this->destinationHeaderValue(
|
||||
$user,
|
||||
$fileDestination
|
||||
);
|
||||
$response = $this->makeDavRequest(
|
||||
$user,
|
||||
"MOVE",
|
||||
$fileSource,
|
||||
$headers
|
||||
);
|
||||
$response = $this->moveResource($user, $fileSource, $fileDestination);
|
||||
$actualStatusCode = $response->getStatusCode();
|
||||
$this->theHTTPStatusCodeShouldBe(
|
||||
201,
|
||||
|
||||
+1
-1
@@ -378,7 +378,7 @@ Feature: share resources where the sharee receives the share in multiple ways
|
||||
| shareType | group |
|
||||
| permissionsRole | Viewer |
|
||||
And user "Alice" has a share "parent" synced
|
||||
And user "Brian" has a share "child1" synced
|
||||
And user "Brian" has a share "parent" synced
|
||||
And user "Carol" has sent the following resource share invitation:
|
||||
| resource | parent/child1 |
|
||||
| space | Personal |
|
||||
|
||||
@@ -155,7 +155,7 @@ Feature: using trashbin together with sharing
|
||||
| sharee | grp1 |
|
||||
| shareType | group |
|
||||
| permissionsRole | Editor |
|
||||
And user "Brain" has a share "shared" synced
|
||||
And user "Brian" has a share "shared" synced
|
||||
And user "Carol" has a share "shared" synced
|
||||
When user "Alice" deletes file "/shared/sub/shared_file.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "204"
|
||||
@@ -179,7 +179,7 @@ Feature: using trashbin together with sharing
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Editor |
|
||||
And user "Brain" has a share "shared" synced
|
||||
And user "Brian" has a share "shared" synced
|
||||
And user "Brian" has moved folder "/Shares/shared" to "/Shares/renamed_shared"
|
||||
And user "Brian" has deleted file "/Shares/renamed_shared/shared_file.txt"
|
||||
When user "Brian" restores the file with original path "/Shares/renamed_shared/shared_file.txt" using the trashbin API
|
||||
|
||||
Reference in New Issue
Block a user