Skip to content

Commit

Permalink
remove ocs endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
nabim777 committed Dec 11, 2023
1 parent 9a90e72 commit db4654c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 55 deletions.
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
50 changes: 13 additions & 37 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -3120,58 +3120,36 @@ public function userTriesToSendGroupCreationRequestUsingTheAPI(string $user, str
*/
public function createTheGroup(string $group, ?string $method = null):void {
//guess yourself
if ($method === null) {
if ($this->isTestingWithLdap()) {
$method = "ldap";
} elseif (OcisHelper::isTestingWithGraphApi()) {
$method = "graph";
} else {
$method = "api";
}
}
$group = \trim($group);
$method = \trim(\strtolower($method));
$groupCanBeDeleted = false;
$groupId = null;
switch ($method) {
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":
if ($method === null) {
if ($this->isTestingWithLdap()) {
try {
$this->createLdapGroup($group);
} catch (LdapException $e) {
throw new Exception(
"could not create group '$group'. Error: $e"
);
}
break;
case "graph":
$newGroup = $this->graphContext->adminHasCreatedGroupUsingTheGraphApi($group);
} elseif (OcisHelper::isTestingWithGraphApi()) {
$newGroup = $this->graphContext->createGroup($group);
if ($newGroup->getStatusCode() === 201) {
$newGroup = $this->getJsonDecodedResponse($newGroup);
}
$groupCanBeDeleted = true;
$groupId = $newGroup["id"];
break;
default:
} else {
throw new InvalidArgumentException(
"Invalid method to create group '$group'"
);
}
}

$this->addGroupToCreatedGroupsList($group, true, $groupCanBeDeleted, $groupId);
Assert::assertTrue(
$this->groupExists($group),
"Group '$group' should exist but does not exist"
);
}

/**
Expand Down Expand Up @@ -3618,8 +3596,6 @@ public function groupExists(string $group):bool {
}
if (OcisHelper::isTestingWithGraphApi()) {
$base = '/graph/v1.0';
} else {
$base = '/ocs/v2.php/cloud';
}
$group = \rawurlencode($group);
$fullUrl = $this->getBaseUrl() . "$base/groups/$group";
Expand Down

0 comments on commit db4654c

Please sign in to comment.