Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci]added test to list drives after the share role has been disabled #10756

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/acceptance/TestHelpers/GraphHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class GraphHelper {
public const ADDITIONAL_PERMISSIONS_ROLES = [
'Secure Viewer' => 'aa97fe03-7980-45ac-9e50-b325749fd7e6',
'Space Editor Without Versions' => '3284f2d5-0070-4ad8-ac40-c247f7c1fb27',
'Denied' => '63e64e19-8d43-42ec-a738-2b6af2610efa',
];

public const SHARES_SPACE_ID = 'a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668';
Expand Down
45 changes: 45 additions & 0 deletions tests/acceptance/bootstrap/OcisConfigContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@
* steps needed to re-configure oCIS server
*/
class OcisConfigContext implements Context {
private array $enabledRoles = [];

/**
* @return array
*/
public function getEnabledRoles(): array {
return $this->enabledRoles;
}

/**
* @param array $enabledRoles
*
* @return void
*/
public function setEnabledRoles(array $enabledRoles): void {
$this->enabledRoles = $enabledRoles;
}

/**
* @Given async upload has been enabled with post-processing delayed to :delayTime seconds
*
Expand Down Expand Up @@ -99,6 +117,33 @@ public function theAdministratorHasEnabledTheRole(string $role): void {
$response->getStatusCode(),
"Failed to enable role $role"
);
$this->setEnabledRoles($defaultRoles);
}

/**
* @Given the administrator has disabled the permissions role :role
*
* @param string $role
*
* @return void
*/
public function theAdministratorHasDisabledThePermissionsRole(string $role): void {
$roleId = GraphHelper::getPermissionsRoleIdByName($role);
$availableRoles = $this->getEnabledRoles();

if ($key = array_search($roleId, $availableRoles)) {
unset($availableRoles[$key]);
}
$envs = [
"GRAPH_AVAILABLE_ROLES" => implode(',', $availableRoles),
];
$response = OcisConfigHelper::reConfigureOcis($envs);
Assert::assertEquals(
200,
$response->getStatusCode(),
"Failed to disable role $role"
);
$this->setEnabledRoles($availableRoles);
}

/**
Expand Down
Loading