Skip to content

Commit

Permalink
[tests-only] remove dedicated spaces cleanup for the localAPI tests (#…
Browse files Browse the repository at this point in the history
…4172)

* No space cleanup in after scene

Signed-off-by: Kiran Parajuli <[email protected]>

* Deleted method 'deleteAllSpacesOfTheType'

Signed-off-by: Kiran Parajuli <[email protected]>
  • Loading branch information
kiranparajuli589 authored Jul 13, 2022
1 parent bead0e3 commit 8434405
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@

use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Behat\Hook\Call\AfterScenario;
use Behat\Gherkin\Node\TableNode;
use Behat\Testwork\Environment\Environment;
use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface;
use TestHelpers\HttpRequestHelper;
Expand Down Expand Up @@ -364,54 +362,6 @@ public function setUpScenario(BeforeScenarioScope $scope): void {
);
}

/**
* @AfterScenario
*
* @return void
*
* @throws Exception|GuzzleException
*/
public function cleanDataAfterTests(): void {
$this->deleteAllSpacesOfTheType('project');
}

/**
* The method first disables and then deletes spaces
*
* @param string $driveType
*
* @return void
*
* @throws Exception|GuzzleException
*/
public function deleteAllSpacesOfTheType(string $driveType): void {
$query = "\$filter=driveType eq $driveType";
$userAdmin = $this->featureContext->getAdminUsername();

for ($i = 0; $i < 2; ++$i) {
$this->theUserListsAllAvailableSpacesUsingTheGraphApi(
$userAdmin,
$query
);

$rawBody = $this->featureContext->getResponse()->getBody()->getContents();
$drives = json_decode($rawBody, true, 512);
if (isset($drives["value"])) {
$drives = $drives["value"];
}

if (!empty($drives)) {
foreach ($drives as $value) {
if (!\array_key_exists("deleted", $value["root"])) {
$this->sendDisableSpaceRequest($userAdmin, $value["name"]);
} else {
$this->sendDeleteSpaceRequest($userAdmin, $value["name"]);
}
}
}
}
}

/**
* Send Graph List My Spaces Request
*
Expand Down

0 comments on commit 8434405

Please sign in to comment.