[tests-only][full-ci] make user enable disable feature use graphapi (#6790)

* make user enable disable feature use graphapi

* change the step definition code for user disable action

* updated step definition code for user disable feature

* updated user disable implementation

* corrected the error of step implementation code
This commit is contained in:
Sabin Panta
2023-07-20 14:27:40 +05:45
committed by GitHub
parent 531efe0b10
commit bed8c77892
3 changed files with 14 additions and 13 deletions
@@ -3825,9 +3825,18 @@ trait Provisioning {
*/
public function adminHasDisabledUserUsingTheProvisioningApi(?string $user):void {
$user = $this->getActualUsername($user);
$this->disableOrEnableUser($this->getAdminUsername(), $user, 'disable');
$this->theHTTPStatusCodeShouldBeSuccess();
$this->ocsContext->assertOCSResponseIndicatesSuccess();
if (OcisHelper::isTestingWithGraphApi()) {
$response = $this->graphContext->editUserUsingTheGraphApi($this->getAdminUsername(), $user, null, null, null, null, false);
} else {
$response = $this->disableOrEnableUser($this->getAdminUsername(), $user, 'disable');
}
Assert::assertEquals(
200,
$response->getStatusCode(),
__METHOD__
. " Expected status code is 200 but received " . $response->getStatusCode()
. "\nResponse body: " . $response->getBody(),
);
}
/**
@@ -5402,20 +5411,19 @@ trait Provisioning {
*
* @return void
*/
public function disableOrEnableUser(string $user, string $otherUser, string $action):void {
public function disableOrEnableUser(string $user, string $otherUser, string $action): ResponseInterface {
$actualUser = $this->getActualUsername($user);
$actualPassword = $this->getPasswordForUser($actualUser);
$actualOtherUser = $this->getActualUsername($otherUser);
$fullUrl = $this->getBaseUrl()
. "/ocs/v$this->ocsApiVersion.php/cloud/users/$actualOtherUser/$action";
$this->response = HttpRequestHelper::put(
return HttpRequestHelper::put(
$fullUrl,
$this->getStepLineRef(),
$actualUser,
$actualPassword
);
$this->pushToLastStatusCodesArrays();
}
/**