mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-02 16:59:56 -05:00
test: do not try graph endpoints if testing on reva
This commit is contained in:
@@ -520,30 +520,25 @@ class WebDavHelper {
|
||||
if (\array_key_exists($user, self::$spacesIdRef) && \array_key_exists("personal", self::$spacesIdRef[$user])) {
|
||||
return self::$spacesIdRef[$user]["personal"];
|
||||
}
|
||||
$trimmedBaseUrl = \trim($baseUrl, "/");
|
||||
$drivesPath = '/graph/v1.0/me/drives';
|
||||
$fullUrl = $trimmedBaseUrl . $drivesPath;
|
||||
$response = HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password
|
||||
);
|
||||
Assert::assertEquals(200, $response->getStatusCode(), "Cannot list drives for user '$user'");
|
||||
|
||||
$personalSpaceId = '';
|
||||
$drives = HttpRequestHelper::getJsonDecodedResponseBodyContent($response);
|
||||
foreach ($drives->value as $drive) {
|
||||
if ($drive->driveType === "personal") {
|
||||
$personalSpaceId = $drive->id;
|
||||
break;
|
||||
if (!OcisHelper::isTestingOnReva()) {
|
||||
$response = GraphHelper::getMySpaces($baseUrl, $user, $password, '', $xRequestId);
|
||||
Assert::assertEquals(200, $response->getStatusCode(), "Cannot list drives for user '$user'");
|
||||
|
||||
$drives = HttpRequestHelper::getJsonDecodedResponseBodyContent($response);
|
||||
foreach ($drives->value as $drive) {
|
||||
if ($drive->driveType === "personal") {
|
||||
$personalSpaceId = $drive->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$personalSpaceId) {
|
||||
// the graph endpoint did not give a useful answer
|
||||
// try getting the information from the webdav endpoint
|
||||
$fullUrl = "$trimmedBaseUrl/" . self::getDavPath(self::DAV_VERSION_NEW, $user);
|
||||
$fullUrl = "$baseUrl/" . self::getDavPath(self::DAV_VERSION_NEW, $user);
|
||||
$response = HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
$xRequestId,
|
||||
|
||||
@@ -1794,31 +1794,18 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :sharee should have a share :share shared by user :sharer from space :space
|
||||
* @Then /^user "([^"]*)" (should|should not) have a share "([^"]*)" shared by user "([^"]*)" from space "([^"]*)"$/
|
||||
*
|
||||
* @param string $sharee
|
||||
* @param string $shouldOrNot
|
||||
* @param string $share
|
||||
* @param string $sharer
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userShouldHaveShareSharedByUserFromSpace(string $sharee, string $share, string $sharer, string $space): void {
|
||||
$this->checkIfShareExists($share, $sharee, $sharer, $space);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :sharee should not have a share :share shared by user :sharer from space :space
|
||||
*
|
||||
* @param string $sharee
|
||||
* @param string $share
|
||||
* @param string $sharer
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userShouldNotHaveShareSharedByUserFromSpace(string $sharee, string $share, string $sharer, string $space): void {
|
||||
$this->checkIfShareExists($share, $sharee, $sharer, $space, false);
|
||||
public function userShouldHaveShareSharedByUserFromSpace(string $sharee, string $shouldOrNot, string $share, string $sharer, string $space): void {
|
||||
$this->checkIfShareExists($share, $sharee, $sharer, $space, $shouldOrNot === "should");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user