mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-23 04:28:48 -05:00
[tests-only][full-ci] Add API tests for deleting groups (graph API) (#5076)
* add API tests for deleting groups * add tests to expected failure * fix php style * update expected failure list extend test * merge scenarios * bump core commit id extend tests descrive scenario * use when step * fix Co-authored-by: Viktor Scharf <scharf.vi@gmail.com>
This commit is contained in:
@@ -139,6 +139,28 @@ class GraphContext implements Context {
|
||||
$this->featureContext->thenTheHTTPStatusCodeShouldBe(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $groupId
|
||||
* @param string|null $user
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userDeletesGroupWithGroupId(
|
||||
string $groupId,
|
||||
?string $user = null
|
||||
): ResponseInterface {
|
||||
$credentials = $this->getAdminOrUserCredentials($user);
|
||||
|
||||
return GraphHelper::deleteGroup(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$credentials["username"],
|
||||
$credentials["password"],
|
||||
$groupId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $groupId
|
||||
* @param bool $checkResult
|
||||
@@ -151,13 +173,7 @@ class GraphContext implements Context {
|
||||
bool $checkResult = false
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
GraphHelper::deleteGroup(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$this->featureContext->getAdminUsername(),
|
||||
$this->featureContext->getAdminPassword(),
|
||||
$groupId
|
||||
)
|
||||
$this->userDeletesGroupWithGroupId($groupId)
|
||||
);
|
||||
if ($checkResult) {
|
||||
$this->featureContext->thenTheHTTPStatusCodeShouldBe(204);
|
||||
@@ -828,6 +844,22 @@ class GraphContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user deletes group :group using the Graph API
|
||||
* @When the administrator deletes group :group using the Graph API
|
||||
* @When user :user tries to delete group :group using the Graph API
|
||||
*
|
||||
* @param string $group
|
||||
* @param string|null $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userDeletesGroupUsingTheGraphApi(string $group, ?string $user): void {
|
||||
$groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id");
|
||||
$response = $this->userDeletesGroupWithGroupId($groupId, $user);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the following users should be listed in the following groups
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user