From 35c14ab0a21122e42ab94dc2e6a68fe7947c0912 Mon Sep 17 00:00:00 2001 From: nabim777 Date: Fri, 8 Dec 2023 13:03:11 +0545 Subject: [PATCH] remove ocs endpoint --- .../features/bootstrap/Provisioning.php | 68 ++++++------------- 1 file changed, 22 insertions(+), 46 deletions(-) diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index c618504ba45..2c2146834bd 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -3120,58 +3120,34 @@ public function userTriesToSendGroupCreationRequestUsingTheAPI(string $user, str */ public function createTheGroup(string $group, ?string $method = null):void { //guess yourself + $group = \trim($group); + $groupCanBeDeleted = false; + $groupId = null; if ($method === null) { if ($this->isTestingWithLdap()) { - $method = "ldap"; + try { + $this->createLdapGroup($group); + } catch (LdapException $e) { + throw new Exception( + "could not create group '$group'. Error: $e" + ); + } } elseif (OcisHelper::isTestingWithGraphApi()) { - $method = "graph"; - } else { - $method = "api"; + $newGroup = $this->graphContext->adminHasCreatedGroupUsingTheGraphApi($group); + $groupCanBeDeleted = true; + $groupId = $newGroup["id"]; } + else { + throw new InvalidArgumentException( + "Invalid method to create group '$group'" + ); + } } - $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": - 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); - $groupCanBeDeleted = true; - $groupId = $newGroup["id"]; - break; - default: - 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" + ); } /**