[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
@@ -623,12 +623,6 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers
- [coreApiWebdavOperations/listFiles.feature:395](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/listFiles.feature#L395)
- [coreApiWebdavOperations/listFiles.feature:400](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/listFiles.feature#L400)
### [graph/users: enable/disable users](https://github.com/owncloud/ocis/issues/3064)
- [coreApiWebdavOperations/refuseAccess.feature:35](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/refuseAccess.feature#L35)
- [coreApiWebdavOperations/refuseAccess.feature:36](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/refuseAccess.feature#L36)
- [coreApiWebdavOperations/refuseAccess.feature:41](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/refuseAccess.feature#L41)
#### [OCS status code zero](https://github.com/owncloud/ocis/issues/3621)
- [coreApiShareManagementToShares/moveReceivedShare.feature:13](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementToShares/moveReceivedShare.feature#L13)
@@ -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();
}
/**
@@ -24,5 +24,4 @@ Feature: share resources with a disabled user
And user "Alice" has been disabled
When user "Alice" shares file "textfile0.txt" with user "Brian" using the sharing API
Then the OCS status code should be "997"
#And the OCS status code should be "401"
And the HTTP status code should be "401"