From bed8c7789252b3f33e18df9ac87d9c243f63e5c8 Mon Sep 17 00:00:00 2001 From: Sabin Panta <64484313+S-Panta@users.noreply.github.com> Date: Thu, 20 Jul 2023 14:27:40 +0545 Subject: [PATCH] [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 --- .../expected-failures-API-on-OCIS-storage.md | 6 ------ .../features/bootstrap/Provisioning.php | 20 +++++++++++++------ .../createShareWithDisabledUser.feature | 1 - 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index bdce9ecb72..7436820da0 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -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) diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index 41d121df2d..bb539b0e86 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -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(); } /** diff --git a/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareWithDisabledUser.feature b/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareWithDisabledUser.feature index bbccb7b170..f5d5479f91 100644 --- a/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareWithDisabledUser.feature +++ b/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareWithDisabledUser.feature @@ -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"