From d2635cc4dfa56165da011129290c44535dbddbaf Mon Sep 17 00:00:00 2001 From: Prajwol Amatya <83579989+PrajwolAmatya@users.noreply.github.com> Date: Wed, 10 Jan 2024 18:41:02 +0545 Subject: [PATCH] added test to send share invitation to a deleted group (#8166) --- .../apiSharingNg/shareInvitations.feature | 63 +++++++++++++++++++ .../features/bootstrap/GraphContext.php | 13 ++++ 2 files changed, 76 insertions(+) diff --git a/tests/acceptance/features/apiSharingNg/shareInvitations.feature b/tests/acceptance/features/apiSharingNg/shareInvitations.feature index 306f06131..1350a752f 100644 --- a/tests/acceptance/features/apiSharingNg/shareInvitations.feature +++ b/tests/acceptance/features/apiSharingNg/shareInvitations.feature @@ -774,3 +774,66 @@ Feature: Send a sharing invitations | Co Owner | folder | FolderToShare | | Uploader | folder | FolderToShare | | Manager | folder | FolderToShare | + + + Scenario Outline: send sharing invitation to a deleted group with different roles + Given user "Carol" has been created with default attributes and without skeleton files + And group "grp1" has been created + And the following users have been added to the following groups + | username | groupname | + | Brian | grp1 | + | Carol | grp1 | + And user "Alice" has uploaded file with content "to share" to "/textfile1.txt" + And user "Alice" has created folder "FolderToShare" + And the administrator has deleted group "grp1" + When user "Alice" sends the following share invitation using the Graph API: + | resourceType | | + | resource | | + | space | Personal | + | sharee | grp1 | + | 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 | + | Co Owner | file | /textfile1.txt | + | Manager | 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/GraphContext.php b/tests/acceptance/features/bootstrap/GraphContext.php index 72a1c6369..f91effcf3 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -1079,6 +1079,19 @@ class GraphContext implements Context { $this->featureContext->setResponse($response); } + /** + * @Given the administrator has deleted group :group + * + * @param string $group + * + * @return void + */ + public function theAdministratorHasDeletedGroup(string $group): void { + $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); + $response = $this->userDeletesGroupWithGroupId($groupId); + $this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response); + } + /** * @Then the following users should be listed in the following groups *