api-tests: delete spaces before users (#1877)

* delete spaces before users

* delete users after deleting spaces

* fix
This commit is contained in:
Viktor Scharf
2025-11-20 09:12:48 +01:00
committed by GitHub
parent 6161e40d43
commit 9d173f0ea6
3 changed files with 22 additions and 32 deletions

View File

@@ -2701,6 +2701,28 @@ class FeatureContext extends BehatVariablesContext {
}
}
/**
* @AfterScenario
*
* @return void
*
* @throws Exception|GuzzleException
*/
public function cleanDataAfterTests(): void {
if (!OcHelper::isTestingOnReva() && !OcHelper::isUsingPreparedLdapUsers()) {
$this->spacesContext->deleteAllProjectSpaces();
}
if (OcHelper::isTestingOnReva()) {
OcHelper::deleteRevaUserData($this->getCreatedUsers());
}
if ($this->isTestingWithLdap()) {
$this->deleteLdapUsersAndGroups();
}
$this->cleanupDatabaseUsers();
$this->cleanupDatabaseGroups();
}
/**
* @BeforeScenario @temporary_storage_on_server
*

View File

@@ -1893,24 +1893,6 @@ trait Provisioning {
);
}
/**
* @AfterScenario
*
* @return void
* @throws Exception
*/
public function afterScenario(): void {
if (OcHelper::isTestingOnReva()) {
OcHelper::deleteRevaUserData($this->getCreatedUsers());
}
if ($this->isTestingWithLdap()) {
$this->deleteLdapUsersAndGroups();
}
$this->cleanupDatabaseUsers();
$this->cleanupDatabaseGroups();
}
/**
*
* @return void

View File

@@ -478,20 +478,6 @@ class SpacesContext implements Context {
$this->archiverContext = BehatHelper::getContext($scope, $environment, 'ArchiverContext');
}
/**
* @AfterScenario
*
* @return void
*
* @throws Exception|GuzzleException
*/
public function cleanDataAfterTests(): void {
if (OcHelper::isTestingOnReva() || OcHelper::isUsingPreparedLdapUsers()) {
return;
}
$this->deleteAllProjectSpaces();
}
/**
* the admin user first disables and then deletes spaces
*