mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-01 01:41:21 -05:00
[tests-only] [full-ci] ApiTest. after each test users delete their personal space (#4433)
* after each test users delete their personal space * Simplify deleteAllPersonalSpaces * Simplify deleteAllPersonalSpaces() Co-authored-by: Phil Davis <phil@jankaritech.com>
This commit is contained in:
@@ -21,7 +21,3 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
|
||||
### [Search by shares jail works incorrect](https://github.com/owncloud/ocis/issues/4014)
|
||||
- [apiSpaces/search.feature:43](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/search.feature#L43)
|
||||
|
||||
### [Changing personal drive quota on another user as admin is not possible](https://github.com/owncloud/ocis/issues/4325)
|
||||
- [apiSpaces/changeSpaces.feature:221](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/changeSpaces.feature#L221)
|
||||
|
||||
|
||||
@@ -126,14 +126,8 @@ class SpacesContext implements Context {
|
||||
$this->createdSpaces[$spaceName] = $spaceCreator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private array $availableSpaces;
|
||||
private array $availableSpaces = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private array $lastPublicLinkData = [];
|
||||
|
||||
/**
|
||||
@@ -378,7 +372,7 @@ class SpacesContext implements Context {
|
||||
|
||||
/**
|
||||
* using method from core to set share data
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastShareData(): void {
|
||||
@@ -428,11 +422,11 @@ class SpacesContext implements Context {
|
||||
public function cleanDataAfterTests(): void {
|
||||
// TODO enable when admin can disable and delete spaces
|
||||
// $this->deleteAllSpacesOfTheType('project');
|
||||
// $this->deleteAllSpacesOfTheType('personal');
|
||||
$this->deleteAllPersonalSpaces();
|
||||
}
|
||||
|
||||
/**
|
||||
* The method first disables and then deletes spaces
|
||||
* Admin first disables and then deletes spaces
|
||||
*
|
||||
* @param string $driveType
|
||||
*
|
||||
@@ -463,6 +457,32 @@ class SpacesContext implements Context {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
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($user["actualUsername"], $value["name"]);
|
||||
}
|
||||
$this->sendDeleteSpaceRequest($user["actualUsername"], $value["name"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Graph List My Spaces Request
|
||||
*
|
||||
@@ -3013,7 +3033,7 @@ class SpacesContext implements Context {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$body = $space['id'];
|
||||
}
|
||||
|
||||
|
||||
$url = "/apps/files_sharing/api/v1/shares?reshares=true&space_ref=" . $body;
|
||||
|
||||
$this->ocsContext->userSendsHTTPMethodToOcsApiEndpointWithBody(
|
||||
|
||||
Reference in New Issue
Block a user