add tests for new role space editor withour versions

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899
2024-09-09 17:01:19 +05:45
parent 6a489f0c99
commit 4c828d36f0
5 changed files with 65 additions and 47 deletions
@@ -24,6 +24,7 @@ use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Exception\GuzzleException;
use TestHelpers\OcisConfigHelper;
use TestHelpers\GraphHelper;
use PHPUnit\Framework\Assert;
/**
@@ -75,6 +76,31 @@ class OcisConfigContext implements Context {
);
}
/**
* @Given the administrator has enabled the permissions role :role
*
* @param string $role
*
* @return void
*/
public function theAdministratorHasEnabledTheRole(string $role): void {
$roleId = GraphHelper::getPermissionsRoleIdByName($role);
$defaultRoles = array_values(GraphHelper::DEFAULT_PERMISSIONS_ROLES);
if (!\in_array($role, $defaultRoles)) {
$defaultRoles[] = $roleId;
}
$envs = [
"GRAPH_AVAILABLE_ROLES" => implode(',', $defaultRoles),
];
$response = OcisConfigHelper::reConfigureOcis($envs);
Assert::assertEquals(
200,
$response->getStatusCode(),
"Failed to enable role $role"
);
}
/**
* @Given the config :configVariable has been set to path :path
*