mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-24 14:50:39 -05:00
Compare commits
2 Commits
v3.5.0
...
caseSearch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da3a893634 | ||
|
|
7bb95d057a |
@@ -1069,7 +1069,7 @@ class GraphHelper {
|
||||
array $body = [],
|
||||
array $headers = []
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'drives/' . $urlArguments);
|
||||
$url = self::getBetaFullUrl($baseUrl, 'drives/' . $urlArguments);
|
||||
|
||||
return HttpRequestHelper::get($url, $xRequestId, $user, $password, $headers, $body);
|
||||
}
|
||||
|
||||
@@ -1985,8 +1985,29 @@ trait Provisioning {
|
||||
if ($this->isTestingWithLdap()) {
|
||||
$this->deleteLdapUsersAndGroups();
|
||||
}
|
||||
|
||||
$assertionFailed = false;
|
||||
$errorMessage = '';
|
||||
|
||||
// check that created users have only one personal space
|
||||
try {
|
||||
$this->setResponse(
|
||||
$this->spacesContext->listAllAvailableSpaces("admin", "%24filter=driveType+eq+personal")
|
||||
);
|
||||
$this->spacesContext->jsonRespondedShouldContainOnlyOneSpace();
|
||||
$this->spacesContext->jsonRespondedShouldNotContainSpaceWithoutName();
|
||||
} catch (\Throwable $e) {
|
||||
$assertionFailed = true;
|
||||
$errorMessage = $e->getMessage();
|
||||
echo "\n[WARNING] Space assertion failed: " . $errorMessage . "\n";
|
||||
}
|
||||
|
||||
$this->cleanupDatabaseUsers();
|
||||
$this->cleanupDatabaseGroups();
|
||||
|
||||
if ($assertionFailed) {
|
||||
throw new \Exception("Space assertion failed:\n" . $errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1087,6 +1087,74 @@ class SpacesContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function jsonRespondedShouldContainOnlyOneSpace(): void {
|
||||
$response = $response ?? $this->featureContext->getResponse();
|
||||
$decodedResponse = $this->featureContext->getJsonDecodedResponse($response);
|
||||
$userAdmin = $this->featureContext->getAdminUsername();
|
||||
|
||||
$aliases = [];
|
||||
foreach ($decodedResponse['value'] as $space) {
|
||||
$alias = $space['driveAlias'];
|
||||
if (isset($aliases[$alias])) {
|
||||
GraphHelper::disableSpace(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$userAdmin,
|
||||
$this->featureContext->getPasswordForUser($userAdmin),
|
||||
$space["id"],
|
||||
$this->featureContext->getStepLineRef()
|
||||
);
|
||||
GraphHelper::deleteSpace(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$userAdmin,
|
||||
$this->featureContext->getPasswordForUser($userAdmin),
|
||||
$space["id"],
|
||||
$this->featureContext->getStepLineRef()
|
||||
);
|
||||
Assert::fail(
|
||||
"Duplicate space found: '$alias'\nResponse:\n" . json_encode($decodedResponse, JSON_PRETTY_PRINT)
|
||||
);
|
||||
}
|
||||
$aliases[$alias] = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function jsonRespondedShouldNotContainSpaceWithoutName(): void {
|
||||
$response = $response ?? $this->featureContext->getResponse();
|
||||
$decodedResponse = $this->featureContext->getJsonDecodedResponse($response);
|
||||
$userAdmin = $this->featureContext->getAdminUsername();
|
||||
|
||||
foreach ($decodedResponse['value'] as $space) {
|
||||
if ($space['name'] === "") {
|
||||
GraphHelper::disableSpace(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$userAdmin,
|
||||
$this->featureContext->getPasswordForUser($userAdmin),
|
||||
$space["id"],
|
||||
$this->featureContext->getStepLineRef()
|
||||
);
|
||||
GraphHelper::deleteSpace(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$userAdmin,
|
||||
$this->featureContext->getPasswordForUser($userAdmin),
|
||||
$space["id"],
|
||||
$this->featureContext->getStepLineRef()
|
||||
);
|
||||
Assert::fail(
|
||||
"Space without name found. \nResponse:\n" . json_encode($decodedResponse, JSON_PRETTY_PRINT)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the user "([^"]*)" should (not |)have a space called "([^"]*)"$/
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user