diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index e60ca70a66a..8b690182d63 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -591,10 +591,6 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [coreApiFavorites/favorites.feature:150](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L150) - [coreApiFavorites/favorites.feature:227](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L227) -#### [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) - #### [HTTP status code differ while deleting file of another user's trash bin](https://github.com/owncloud/ocis/issues/3544) - [coreApiTrashbin/trashbinDelete.feature:105](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiTrashbin/trashbinDelete.feature#L105) diff --git a/tests/acceptance/features/bootstrap/GraphContext.php b/tests/acceptance/features/bootstrap/GraphContext.php index 500e9320afc..4bb2062a80d 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -346,17 +346,14 @@ public function adminHasDeletedGroupUsingTheGraphApi(string $group): void { * @return void * @throws GuzzleException */ - public function adminDeletesUserUsingTheGraphApi(string $user, ?string $byUser = null): void { + public function adminDeletesUserUsingTheGraphApi(string $user, ?string $byUser = null): ResponseInterface { $credentials = $this->getAdminOrUserCredentials($byUser); - - $this->featureContext->setResponse( - GraphHelper::deleteUser( - $this->featureContext->getBaseUrl(), - $this->featureContext->getStepLineRef(), - $credentials["username"], - $credentials["password"], - $user - ) + return GraphHelper::deleteUser( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $credentials["username"], + $credentials["password"], + $user ); } @@ -442,8 +439,8 @@ public function theUserTriesToDeleteNonExistingUser(string $byUser): void { * @throws GuzzleException */ public function theUserHasDeletesAUserUsingTheGraphAPI(string $byUser, string $user): void { - $this->adminDeletesUserUsingTheGraphApi($user, $byUser); - $this->featureContext->thenTheHTTPStatusCodeShouldBe(204); + $response = $this->adminDeletesUserUsingTheGraphApi($user, $byUser); + $this->featureContext->theHttpStatusCodeShouldBe(204, "", $response); } /** diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index 27f47ebcb43..48fb0ec354e 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -1425,7 +1425,8 @@ public function userHasTriedToResetPasswordOfUserUsingTheProvisioningApi(?string */ public function theAdministratorHasDeletedUserUsingTheProvisioningApi(?string $user):void { $user = $this->getActualUsername($user); - $this->deleteTheUserUsingTheProvisioningApi($user); + $response = $this->deleteUser($user); + $this->theHttpStatusCodeShouldBe(204, "", $response); WebDavHelper::removeSpaceIdReferenceForUser($user); $this->userShouldNotExist($user); } @@ -1440,51 +1441,8 @@ public function theAdministratorHasDeletedUserUsingTheProvisioningApi(?string $u */ public function theAdminDeletesUserUsingTheProvisioningApi(string $user):void { $user = $this->getActualUsername($user); - $this->deleteTheUserUsingTheProvisioningApi($user); - $this->rememberThatUserIsNotExpectedToExist($user); - } - - /** - * @When the administrator deletes the following users using the provisioning API - * - * @param TableNode $table - * - * @return void - * @throws Exception - */ - public function theAdministratorDeletesTheFollowingUsersUsingTheProvisioningApi(TableNode $table):void { - $this->verifyTableNodeColumns($table, ["username"]); - $usernames = $table->getHash(); - foreach ($usernames as $username) { - $this->theAdminDeletesUserUsingTheProvisioningApi($username["username"]); - } - } - - /** - * @When user :user deletes user :otherUser using the provisioning API - * - * @param string $user - * @param string $otherUser - * - * @return void - * @throws Exception - */ - public function userDeletesUserUsingTheProvisioningApi( - string $user, - string $otherUser - ):void { - $actualUser = $this->getActualUsername($user); - $actualPassword = $this->getUserPassword($actualUser); - $actualOtherUser = $this->getActualUsername($otherUser); - - $this->response = UserHelper::deleteUser( - $this->getBaseUrl(), - $actualOtherUser, - $actualUser, - $actualPassword, - $this->getStepLineRef(), - $this->ocsApiVersion - ); + $this->setResponse($this->deleteUser($user)); + $this->pushToLastHttpStatusCodesArray(); } /** @@ -2333,28 +2291,13 @@ public function userHasBeenDeleted(string $user):void { if ($this->isTestingWithLdap() && \in_array($user, $this->ldapCreatedUsers)) { $this->deleteLdapUser($user); } else { - $this->deleteTheUserUsingTheProvisioningApi($user); + $response = $this->deleteUser($user); + $this->theHTTPStatusCodeShouldBe(204, "", $response); } } $this->userShouldNotExist($user); } - /** - * @Given the following users have been deleted - * - * @param TableNode $table - * - * @return void - * @throws Exception - */ - public function theFollowingUsersHaveBeenDeleted(TableNode $table):void { - $this->verifyTableNodeColumns($table, ["username"]); - $usernames = $table->getHash(); - foreach ($usernames as $username) { - $this->userHasBeenDeleted($username["username"]); - } - } - /** * @Given these users have been initialized: * expects a table of users with the heading @@ -2722,17 +2665,6 @@ public function userHasBeenCreated( $this->initializeUser($user, $password); } - /** - * @param string $user - * - * @return void - * @throws Exception - */ - public function deleteUser(string $user):void { - $this->deleteTheUserUsingTheProvisioningApi($user); - $this->userShouldNotExist($user); - } - /** * Try to delete the group, catching anything bad that might happen. * Use this method only in places where you want to try as best you @@ -3538,15 +3470,13 @@ public function userTriesToEnableUserUsingTheProvisioningApi( * @return void * @throws Exception */ - public function deleteTheUserUsingTheProvisioningApi(string $user):void { - $this->emptyLastHTTPStatusCodesArray(); - $this->emptyLastOCSStatusCodesArray(); + public function deleteUser(string $user):ResponseInterface { // Always try to delete the user if (OcisHelper::isTestingWithGraphApi()) { // users can be deleted using the username in the GraphApi too - $this->graphContext->adminDeletesUserUsingTheGraphApi($user); + $response = $this->graphContext->adminDeletesUserUsingTheGraphApi($user); } else { - $this->response = UserHelper::deleteUser( + $response = UserHelper::deleteUser( $this->getBaseUrl(), $user, $this->getAdminUsername(), @@ -3555,22 +3485,7 @@ public function deleteTheUserUsingTheProvisioningApi(string $user):void { $this->ocsApiVersion ); } - $this->pushToLastStatusCodesArrays(); - - // Only log a message if the test really expected the user to have been - // successfully created (i.e. the delete is expected to work) and - // there was a problem deleting the user. Because in this case there - // might be an effect on later tests. - if ($this->theUserShouldExist($user) - && (!\in_array($this->response->getStatusCode(), [200, 204])) - ) { - \error_log( - "INFORMATION: could not delete user '$user' " - . $this->response->getStatusCode() . " " . $this->response->getBody() - ); - } - - $this->rememberThatUserIsNotExpectedToExist($user); + return $response; } /** @@ -4974,10 +4889,12 @@ public function cleanupDatabaseUsers():void { $this->usingServer('LOCAL'); foreach ($this->createdUsers as $userData) { $this->deleteUser($userData['actualUsername']); + $this->userShouldNotExist($userData['actualUsername']); } $this->usingServer('REMOTE'); foreach ($this->createdRemoteUsers as $userData) { $this->deleteUser($userData['actualUsername']); + $this->userShouldNotExist($userData['actualUsername']); } $this->usingServer($previousServer); } diff --git a/tests/acceptance/features/coreApiShareManagementToShares/moveReceivedShare.feature b/tests/acceptance/features/coreApiShareManagementToShares/moveReceivedShare.feature index ec78b86c3bb..9c59063c49f 100644 --- a/tests/acceptance/features/coreApiShareManagementToShares/moveReceivedShare.feature +++ b/tests/acceptance/features/coreApiShareManagementToShares/moveReceivedShare.feature @@ -19,7 +19,7 @@ Feature: sharing And user "Brian" moves folder "/Shares/TMP" to "/Shares/new" using the WebDAV API And the administrator deletes user "Carol" using the provisioning API Then the OCS status code of responses on all endpoints should be "100" - And the HTTP status code of responses on all endpoints should be "200" + And the HTTP status code of responses on each endpoint should be "200, 201, 204" respectively And user "Brian" should see the following elements | /Shares/new/|