diff --git a/tests/TestHelpers/GraphHelper.php b/tests/TestHelpers/GraphHelper.php index d6d83be73a..d81e316253 100644 --- a/tests/TestHelpers/GraphHelper.php +++ b/tests/TestHelpers/GraphHelper.php @@ -1811,7 +1811,7 @@ class GraphHelper { $body ); } - + /** * @param string $baseUrl * @param string $xRequestId diff --git a/tests/acceptance/features/apiSharingNg/shareInvitations.feature b/tests/acceptance/features/apiSharingNg/shareInvitations.feature index 355df5aac9..cff81f73e0 100644 --- a/tests/acceptance/features/apiSharingNg/shareInvitations.feature +++ b/tests/acceptance/features/apiSharingNg/shareInvitations.feature @@ -1589,3 +1589,78 @@ Feature: Send a sharing invitations | resource-type | path | | file | /textfile1.txt | | folder | FolderToShare | + + + Scenario Outline: send share invitation for project space to user with different roles + Given using spaces DAV path + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "NewSpace" with the default quota using the Graph API + When user "Alice" sends the following share invitation for space using the Graph API: + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "type": "array", + "items": { + "type": "object", + "required": [ + "grantedToV2", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "roles": { + "type": "array", + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } + } + } + } + } + } + } + """ + Examples: + | permissions-role | + | Space Viewer | + | Space Editor | + | Co Owner | + | Manager | diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index 1de287ae59..bc9bbedb16 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -151,9 +151,8 @@ class SharingNgContext implements Context { $rows['resource'] ); } else { - $itemId = ($rows['resourceType'] === 'folder') - ? $this->spacesContext->getResourceId($user, $rows['space'], $rows['resource']) - : $this->spacesContext->getFileId($user, $rows['space'], $rows['resource']); + $resource = $rows['resource'] ?? ''; + $itemId = $this->spacesContext->getResourceId($user, $rows['space'], $resource); } if (\array_key_exists('shareeId', $rows)) { @@ -211,6 +210,7 @@ class SharingNgContext implements Context { /** * @When /^user "([^"]*)" sends the following share invitation using the Graph API:$/ * @When /^user "([^"]*)" tries to send the following share invitation using the Graph API:$/ + * @When user :user sends the following share invitation for space using the Graph API: * * @param string $user * @param TableNode $table