Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[full-ci][tests-only] Adding spaces webdav variant for favorites api features #39686

Merged
merged 2 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions tests/TestHelpers/WebDavHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,18 +460,16 @@ public static function makeDavRequest(
):ResponseInterface {
$baseUrl = self::sanitizeUrl($baseUrl, true);

$usingSpacesDavPath = false;
$spaceId = null;
// get space id if testing with spaces dav
if ($davPathVersionToUse === 3) {
$usingSpacesDavPath = true;
$spaceId = self::getPersonalSpaceIdForUser($baseUrl, $user, $password, $xRequestId);
}

if ($doDavRequestAsUser === null) {
$davPath = self::getDavPath($user, $davPathVersionToUse, $type, $usingSpacesDavPath, $spaceId);
$davPath = self::getDavPath($user, $davPathVersionToUse, $type, $spaceId);
} else {
$davPath = self::getDavPath($doDavRequestAsUser, $davPathVersionToUse, $type, $usingSpacesDavPath, $spaceId);
$davPath = self::getDavPath($doDavRequestAsUser, $davPathVersionToUse, $type, $spaceId);
}

//replace %, # and ? and in the path, Guzzle will not encode them
Expand Down Expand Up @@ -536,7 +534,6 @@ public static function makeDavRequest(
* @param string|null $user
* @param int|null $davPathVersionToUse (1|2)
* @param string|null $type
* @param bool $usingSpaces
* @param string|null $spaceId
*
* @return string
Expand All @@ -545,7 +542,6 @@ public static function getDavPath(
?string $user,
?int $davPathVersionToUse = null,
?string $type = "files",
?bool $usingSpaces = false,
?string $spaceId = null
):string {
if ($type === "public-files" || $type === "public-files-old") {
Expand All @@ -560,7 +556,7 @@ public static function getDavPath(
if ($type === "customgroups") {
return "remote.php/dav/";
}
if ($usingSpaces) {
if ($davPathVersionToUse === 3) {
return "dav/spaces/" . $spaceId . '/';
} else {
if ($davPathVersionToUse === 1) {
Expand Down
46 changes: 44 additions & 2 deletions tests/acceptance/features/apiFavorites/favorites.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@issue-ocis-reva-276
Scenario Outline: Favorite and unfavorite a folder
Given using <dav_version> DAV path
Expand All @@ -44,6 +49,11 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@smokeTest @issue-ocis-reva-276
Scenario Outline: Favorite a file
Given using <dav_version> DAV path
Expand All @@ -59,6 +69,11 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@smokeTest @issue-ocis-reva-276
Scenario Outline: Favorite and unfavorite a file
Given using <dav_version> DAV path
Expand All @@ -75,6 +90,11 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@smokeTest
Scenario Outline: Get favorited elements of a folder
Given using <dav_version> DAV path
Expand All @@ -91,6 +111,11 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

Scenario Outline: Get favorited elements of a subfolder
Given using <dav_version> DAV path
And user "Alice" has created folder "/subfolder"
Expand All @@ -112,7 +137,12 @@ Feature: favorite
| old |
| new |

@files_sharing-app-required
@skipOnOcV10
Examples:
| dav_version |
| spaces |

@files_sharing-app-required @issue-ocis-2968
Scenario Outline: moving a favorite file out of a share keeps favorite state
Given using <dav_version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
Expand All @@ -128,6 +158,11 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@issue-33840 @skipOnOcV10
Scenario Outline: Get favorited elements and limit count of entries
Given using <dav_version> DAV path
Expand All @@ -147,6 +182,7 @@ Feature: favorite
| dav_version |
| old |
| new |
| spaces |

@issue-33840 @skipOnOcV10
Scenario Outline: Get favorited elements paginated in subfolder
Expand Down Expand Up @@ -175,6 +211,7 @@ Feature: favorite
| dav_version |
| old |
| new |
| spaces |

@files_sharing-app-required @notToImplementOnOCIS
Scenario Outline: sharer file favorite state should not change the favorite state of sharee
Expand Down Expand Up @@ -217,6 +254,11 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@files_sharing-app-required @notToImplementOnOCIS
Scenario Outline: favorite a file inside of a received share
Given using <dav_version> DAV path
Expand Down Expand Up @@ -252,4 +294,4 @@ Feature: favorite
Examples:
| dav_version |
| old |
| new |
| new |
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: favorite
And user "Alice" has created folder "/PARENT"
And user "Alice" has uploaded file with content "some data" to "/PARENT/parent.txt"


@issue-ocis-2968
Scenario Outline: favorite a file inside of a received share
Given using <dav_version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
Expand All @@ -21,7 +21,12 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@issue-ocis-2968
Scenario Outline: favorite a folder inside of a received share
Given using <dav_version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
Expand All @@ -35,7 +40,12 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@issue-ocis-2968
Scenario Outline: favorite a received share itself
Given using <dav_version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
Expand All @@ -48,7 +58,12 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@issue-ocis-2968
Scenario Outline: moving a favorite file out of a share keeps favorite state
Given using <dav_version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
Expand All @@ -62,7 +77,12 @@ Feature: favorite
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |

@issue-ocis-2968
Scenario Outline: sharee file favorite state should not change the favorite state of sharer
Given using <dav_version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
Expand All @@ -75,3 +95,8 @@ Feature: favorite
| dav_version |
| old |
| new |

@skipOnOcV10
Examples:
| dav_version |
| spaces |
16 changes: 9 additions & 7 deletions tests/acceptance/features/bootstrap/ChecksumContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,17 @@ public function userRequestsTheChecksumOfViaPropfind(string $user, string $path)
$user,
$this->featureContext->getDavPathVersion()
) . $path;
$url = WebDavHelper::sanitizeUrl($url);
$response = HttpRequestHelper::sendRequest(
$url,
$this->featureContext->getStepLineRef(),
'PROPFIND',
$password = $this->featureContext->getPasswordForUser($user);
$response = WebDavHelper::makeDavRequest(
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$password,
'PROPFIND',
$path,
null,
$body
$this->featureContext->getStepLineRef(),
$body,
$this->featureContext->getDavPathVersion()
);
$this->featureContext->setResponse($response);
}
Expand Down
15 changes: 15 additions & 0 deletions tests/acceptance/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use TestHelpers\UploadHelper;
use TestHelpers\OcisHelper;
use Laminas\Ldap\Ldap;
use TestHelpers\WebDavHelper;

require_once 'bootstrap.php';

Expand Down Expand Up @@ -3610,6 +3611,20 @@ public function clearFileLocks():void {
}
}

/**
* @AfterScenario
*
* clear space id reference
*
* @return void
* @throws Exception
*/
public function clearSpaceId():void {
if (\count(WebDavHelper::$spacesIdRef) > 0) {
WebDavHelper::$spacesIdRef = [];
}
}

/**
* @BeforeSuite
*
Expand Down
30 changes: 27 additions & 3 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,22 @@ public function usingSpacesDavPath():void {
* @return string
*/
public function getFullDavFilesPath(string $user):string {
$path = $this->getBasePath() . "/" .
WebDavHelper::getDavPath($user, $this->getDavPathVersion());
$spaceId = null;
$spaceDavPath = null;
if ($this->getDavPathVersion() === 3) {
$spaceId = WebDavHelper::getPersonalSpaceIdForUser(
$this->getBaseUrl(),
$user,
$this->getPasswordForUser($user),
$this->getStepLineRef()
);
$spaceDavPath = "dav/spaces/users/" . $spaceId . '/';
$path = $this->getBasePath() . "/" .
$spaceDavPath;
} else {
$path = $this->getBasePath() . "/" .
WebDavHelper::getDavPath($user, $this->getDavPathVersion());
}
$path = WebDavHelper::sanitizeUrl($path);
return \ltrim($path, "/");
}
Expand Down Expand Up @@ -593,10 +607,20 @@ public function waitForDavRequestsToFinish():void {
* @param string $fileDestination
*
* @return string
* @throws GuzzleException
*/
public function destinationHeaderValue(string $user, string $fileDestination):string {
$spaceId = null;
if ($this->getDavPathVersion() === 3) {
$spaceId = WebDavHelper::getPersonalSpaceIdForUser(
$this->getBaseUrl(),
$user,
$this->getPasswordForUser($user),
$this->getStepLineRef()
);
}
$fullUrl = $this->getBaseUrl() . '/' .
WebDavHelper::getDavPath($user, $this->getDavPathVersion());
WebDavHelper::getDavPath($user, $this->getDavPathVersion(), "files", $spaceId);
return \rtrim($fullUrl, '/') . '/' . \ltrim($fileDestination, '/');
}

Expand Down