Skip to content

Commit

Permalink
delete users with their personal spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ScharfViktor committed Sep 7, 2022
1 parent d64aa99 commit 8acc269
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public function setUpScenario(BeforeScenarioScope $scope): void {
*/
public function cleanDataAfterTests(): void {
$this->deleteAllProjectSpaces();
$this->deleteAllPersonalSpaces();
$this->deleteAllCreatedUsers();
}

/**
Expand Down Expand Up @@ -519,31 +519,27 @@ public function deleteAllProjectSpaces(): void {
}

/**
* users delete their personal space at the end of the test
*
* @return void
*
* @throws Exception|GuzzleException
*/
public function deleteAllPersonalSpaces(): void {
$query = "\$filter=driveType eq personal";
$createdUsers = $this->featureContext->getCreatedUsers();
$userAdmin = $this->featureContext->getAdminUsername();

foreach ($createdUsers as $user) {
$this->theUserListsAllHisAvailableSpacesUsingTheGraphApi(
$user["actualUsername"],
$query
);
$drives = $this->getAvailableSpaces();
foreach ($drives as $value) {
if (!\array_key_exists("deleted", $value["root"])) {
$this->sendDisableSpaceRequest($userAdmin, $value["name"]);
}
$this->sendDeleteSpaceRequest($userAdmin, $value["name"]);
}
}
}
* 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
Expand Down

0 comments on commit 8acc269

Please sign in to comment.