From 3c235d9920026fa1fa92506a4f58720f5cb9c152 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Wed, 7 Sep 2022 19:10:27 +0200 Subject: [PATCH 1/2] delete users with their personal spaces --- .../features/bootstrap/SpacesContext.php | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index f033f3192..d0e668f9e 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -476,7 +476,7 @@ class SpacesContext implements Context { */ public function cleanDataAfterTests(): void { $this->deleteAllProjectSpaces(); - $this->deleteAllPersonalSpaces(); + $this->deleteAllCreatedUsers(); } /** @@ -519,29 +519,25 @@ class SpacesContext implements Context { } /** - * users delete their personal space at the end of the test + * admin deletes created user with their personal space (this happens automatically after deleting users) * * @return void * * @throws Exception|GuzzleException */ - public function deleteAllPersonalSpaces(): void { - $query = "\$filter=driveType eq personal"; + public function deleteAllCreatedUsers(): void { $createdUsers = $this->featureContext->getCreatedUsers(); - $userAdmin = $this->featureContext->getAdminUsername(); foreach ($createdUsers as $user) { - $this->theUserListsAllHisAvailableSpacesUsingTheGraphApi( - $user["actualUsername"], - $query + $this->featureContext->setResponse( + GraphHelper::deleteUser( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $this->featureContext->getAdminUsername(), + $this->featureContext->getAdminPassword(), + $user['actualUsername'] + ) ); - $drives = $this->getAvailableSpaces(); - foreach ($drives as $value) { - if (!\array_key_exists("deleted", $value["root"])) { - $this->sendDisableSpaceRequest($userAdmin, $value["name"]); - } - $this->sendDeleteSpaceRequest($userAdmin, $value["name"]); - } } } From 070818ac99f414c23027fec2d8f1069668c0b87f Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Thu, 8 Sep 2022 10:02:53 +0200 Subject: [PATCH 2/2] delete method --- .../features/bootstrap/SpacesContext.php | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index d0e668f9e..f0840b64e 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -476,7 +476,6 @@ class SpacesContext implements Context { */ public function cleanDataAfterTests(): void { $this->deleteAllProjectSpaces(); - $this->deleteAllCreatedUsers(); } /** @@ -518,29 +517,6 @@ class SpacesContext implements Context { } } - /** - * admin deletes created user with their personal space (this happens automatically after deleting users) - * - * @return void - * - * @throws Exception|GuzzleException - */ - public function deleteAllCreatedUsers(): void { - $createdUsers = $this->featureContext->getCreatedUsers(); - - foreach ($createdUsers as $user) { - $this->featureContext->setResponse( - GraphHelper::deleteUser( - $this->featureContext->getBaseUrl(), - $this->featureContext->getStepLineRef(), - $this->featureContext->getAdminUsername(), - $this->featureContext->getAdminPassword(), - $user['actualUsername'] - ) - ); - } - } - /** * Send Propfind Request to Url *