diff --git a/tests/acceptance/features/apiSharingNg/shareInvitations.feature b/tests/acceptance/features/apiSharingNg/shareInvitations.feature index dd2bb5629b4..4e86c533d46 100644 --- a/tests/acceptance/features/apiSharingNg/shareInvitations.feature +++ b/tests/acceptance/features/apiSharingNg/shareInvitations.feature @@ -1093,3 +1093,57 @@ Feature: Send a sharing invitations | Co Owner | folder | FolderToShare | | Uploader | folder | FolderToShare | | Manager | folder | FolderToShare | + + + Scenario Outline: send sharing invitation to non-existing group + Given user "Alice" has uploaded file with content "to share" to "/textfile1.txt" + And user "Alice" has created folder "FolderToShare" + When user "Alice" sends the following share invitation using the Graph API: + | resourceType | | + | resource | | + | space | Personal | + | sharee | nonExistentGroup | + | shareType | group | + | permissionsRole | | + Then the HTTP status code should be "400" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "string", + "enum": [ + "generalException" + ] + }, + "message": { + "type": "string", + "enum": [ + "itemNotFound: not found" + ] + } + } + } + } + } + """ + Examples: + | permissions-role | resource-type | path | + | Viewer | file | /textfile1.txt | + | File Editor | file | /textfile1.txt | + | Viewer | folder | FolderToShare | + | Editor | folder | FolderToShare | + | Co Owner | folder | FolderToShare | + | Uploader | folder | FolderToShare | + | Manager | folder | FolderToShare | diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index 7f18bd793c9..bb4492301f8 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -23,6 +23,7 @@ use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Psr\Http\Message\ResponseInterface; use TestHelpers\GraphHelper; +use TestHelpers\WebDavHelper; use Behat\Gherkin\Node\TableNode; use PHPUnit\Framework\Assert; @@ -150,9 +151,10 @@ public function sendShareInvitation(string $user, TableNode $table): ResponseInt $shareeIds = []; foreach ($sharees as $index => $sharee) { $shareType = $shareTypes[$index]; - $shareeIds[] = ($shareType === 'user') + // for non-exiting group or user, generate random id + $shareeIds[] = (($shareType === 'user') ? $this->featureContext->getAttributeOfCreatedUser($sharee, 'id') - : $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id'); + : $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id')) ?: WebDavHelper::generateUUIDv4(); } $permissionsRole = $rows['permissionsRole'] ?? null;