Skip to content

Commit

Permalink
addressing the review
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Panta committed Oct 9, 2023
1 parent d1a9b67 commit 711dba5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions tests/acceptance/features/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
}

/**
Expand Down
7 changes: 4 additions & 3 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down Expand Up @@ -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()
Expand All @@ -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
);
Expand All @@ -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;
}

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

0 comments on commit 711dba5

Please sign in to comment.