Skip to content

Commit

Permalink
added test to list shares shredWithMe after the share role has been d…
Browse files Browse the repository at this point in the history
…isabled
  • Loading branch information
PrajwolAmatya committed Dec 10, 2024
1 parent 154feaa commit 44f524c
Show file tree
Hide file tree
Showing 3 changed files with 1,012 additions and 0 deletions.
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

0 comments on commit 44f524c

Please sign in to comment.