[tests-only] remove dedicated spaces cleanup for the localAPI tests (#4172)
* No space cleanup in after scene Signed-off-by: Kiran Parajuli <kiranparajuli589@gmail.com> * Deleted method 'deleteAllSpacesOfTheType' Signed-off-by: Kiran Parajuli <kiranparajuli589@gmail.com>
This commit is contained in:
@@ -24,9 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
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;
|
||||
@@ -364,54 +362,6 @@ class SpacesContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user