From 711dba50bf854c677e3e7d3c9b3fb8c21bd89b72 Mon Sep 17 00:00:00 2001 From: Sabin Date: Mon, 9 Oct 2023 15:48:42 +0545 Subject: [PATCH] addressing the review --- tests/acceptance/features/bootstrap/GraphContext.php | 10 +++++----- tests/acceptance/features/bootstrap/Provisioning.php | 7 ++++--- .../createShareReceivedInMultipleWays.feature | 9 ++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/acceptance/features/bootstrap/GraphContext.php b/tests/acceptance/features/bootstrap/GraphContext.php index 494e57a0a1e..53498a18f7f 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -762,8 +762,7 @@ public function theUserCreatesNewUser(string $user, TableNode $table): void { /** * adds a user to a group - * Note that the string "nonexistent" shouldn't be used for username and groupname - * Only for nonexistent testcase + * NOTE: If you want to do request with non-existing user or group,use provide "nonexistent" as their name * * @param string $group * @param string $user @@ -774,13 +773,13 @@ public function theUserCreatesNewUser(string $user, TableNode $table): void { */ public function addUserToGroup(string $group, string $user, ?string $byUser = null): ResponseInterface { $credentials = $this->getAdminOrUserCredentials($byUser); - //user shouldn't be created with "nonexistent" name but only used when for nonexistent group testcase + // NOTE: If you want to do request with non-existing group,use "nonexistent" as the name if ($group === "nonexistent") { $groupId = WebDavHelper::generateUUIDv4(); } else { $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); } - //user shouldn't be created with "nonexistent" name but used when for nonexistent users testcase + // NOTE: If you want to do request with non-existing user,use "nonexistent" as the name if ($user === "nonexistent") { $userId = WebDavHelper::generateUUIDv4(); } else { @@ -811,11 +810,12 @@ public function adminHasAddedUserToGroupUsingTheGraphApi( string $user, string $group, bool $checkResult = true - ): void { + ): ResponseInterface { $result = $this->addUserToGroup($group, $user); if ($checkResult && ($result->getStatusCode() !== 204)) { $this->throwHttpException($result, "Could not add user '$user' to group '$group'."); } + return $result; } /** diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index e0fe56b0a32..e6d2d958cc1 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -2966,7 +2966,7 @@ public function userBelongsToGroup(string $user, string $group):bool { * @throws Exception */ public function adminAddsUserToGroupUsingTheProvisioningApi(string $user, string $group):void { - $this->addUserToGroup($user, $group); + $this->setResponse($this->addUserToGroup($user, $group)); } /** @@ -3035,7 +3035,7 @@ public function theFollowingUserHaveBeenAddedToTheFollowingGroup(TableNode $tabl * @return void * @throws Exception */ - public function addUserToGroup(string $user, string $group, ?string $method = null, bool $checkResult = false):void { + public function addUserToGroup(string $user, string $group, ?string $method = null, bool $checkResult = false):ResponseInterface { $user = $this->getActualUsername($user); if ($method === null && $this->isTestingWithLdap() @@ -3061,7 +3061,7 @@ public function addUserToGroup(string $user, string $group, ?string $method = nu }; break; case "graph": - $this->graphContext->adminHasAddedUserToGroupUsingTheGraphApi( + $result = $this->graphContext->adminHasAddedUserToGroupUsingTheGraphApi( $user, $group ); @@ -3071,6 +3071,7 @@ public function addUserToGroup(string $user, string $group, ?string $method = nu "Invalid method to add a user to a group" ); } + return $result; } /** diff --git a/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature b/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature index 71822ea9f78..02642bba885 100644 --- a/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature +++ b/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature @@ -176,16 +176,15 @@ Feature: share resources where the sharee receives the share in multiple ways | shareWith | grp1 | And user "Brian" has accepted share "/lorem.txt" offered by user "Alice" When the administrator adds user "Carol" to group "grp1" using the provisioning API - Then the OCS status code should be "" - And the HTTP status code should be "200" + Then the HTTP status code should be "204" And user "Carol" should be able to accept pending share "/lorem.txt" offered by user "Alice" And the content of file "Shares/lorem.txt" for user "Brian" should be "Shared content" And the content of file "lorem.txt" for user "Carol" should be "My content" And the content of file "Shares/lorem.txt" for user "Carol" should be "Shared content" Examples: - | ocs_api_version | ocs_status_code | - | 1 | 100 | - | 2 | 200 | + | ocs_api_version | + | 1 | + | 2 | @issue-2440 Scenario: sharing parent folder to user with all permissions and its child folder to group with read permission then check create operation