Skip to content

Commit

Permalink
[tests-only][full-ci] make user enable disable feature use graphapi (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
S-Panta authored Jul 20, 2023
1 parent 531efe0 commit bed8c77
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
6 changes: 0 additions & 6 deletions tests/acceptance/expected-failures-API-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 14 additions & 6 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -3825,9 +3825,18 @@ public function theAdministratorDisablesTheFollowingUsersUsingTheProvisioningApi
*/
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(),
);
}

/**
Expand Down Expand Up @@ -5402,20 +5411,19 @@ public function rememberGroupsThatExistAtTheStartOfTheScenario():void {
*
* @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();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit bed8c77

Please sign in to comment.