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

[tests-only][full-CI] Remove OCS endpoint for group creation #7864

Merged
merged 1 commit into from
Dec 19, 2023
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
18 changes: 0 additions & 18 deletions tests/acceptance/features/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -943,24 +943,6 @@ public function userHasCreatedGroupUsingTheGraphApi(string $group, ?string $user
}
}

/**
* create group with provided data
*
* @param string $group
*
* @return array
* @throws Exception
* @throws GuzzleException
*/
public function adminHasCreatedGroupUsingTheGraphApi(string $group): array {
$result = $this->createGroup($group);
if ($result->getStatusCode() === 201) {
return $this->featureContext->getJsonDecodedResponse($result);
} else {
$this->throwHttpException($result, "Could not create group '$group'.");
}
}

/**
* @param ResponseInterface $response
* @param string $errorMsg
Expand Down
33 changes: 6 additions & 27 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -3123,34 +3123,15 @@ public function createTheGroup(string $group, ?string $method = null):void {
if ($method === null) {
if ($this->isTestingWithLdap()) {
$method = "ldap";
} elseif (OcisHelper::isTestingWithGraphApi()) {
$method = "graph";
} else {
$method = "api";
$method = "graph";
}
}
$group = \trim($group);
$method = \trim(\strtolower($method));
$groupCanBeDeleted = false;
$groupId = null;
switch ($method) {
nabim777 marked this conversation as resolved.
Show resolved Hide resolved
case "api":
$result = UserHelper::createGroup(
$this->getBaseUrl(),
$group,
$this->getAdminUsername(),
$this->getAdminPassword(),
$this->getStepLineRef()
);
if ($result->getStatusCode() === 200) {
$groupCanBeDeleted = true;
} else {
throw new Exception(
"could not create group '$group'. "
. $result->getStatusCode() . " " . $result->getBody()
);
}
break;
case "ldap":
try {
$this->createLdapGroup($group);
Expand All @@ -3161,7 +3142,10 @@ public function createTheGroup(string $group, ?string $method = null):void {
}
break;
case "graph":
$newGroup = $this->graphContext->adminHasCreatedGroupUsingTheGraphApi($group);
$newGroup = $this->graphContext->createGroup($group);
if ($newGroup->getStatusCode() === 201) {
SagarGi marked this conversation as resolved.
Show resolved Hide resolved
$newGroup = $this->getJsonDecodedResponse($newGroup);
}
$groupCanBeDeleted = true;
$groupId = $newGroup["id"];
break;
Expand Down Expand Up @@ -3616,13 +3600,8 @@ public function groupExists(string $group):bool {
}
return false;
}
if (OcisHelper::isTestingWithGraphApi()) {
$base = '/graph/v1.0';
} else {
$base = '/ocs/v2.php/cloud';
nabim777 marked this conversation as resolved.
Show resolved Hide resolved
}
$group = \rawurlencode($group);
$fullUrl = $this->getBaseUrl() . "$base/groups/$group";
$fullUrl = $this->getBaseUrl() . "/graph/v1.0/groups/$group";
$this->response = HttpRequestHelper::get(
$fullUrl,
$this->getStepLineRef(),
Expand Down