From c3716d10394bcbfe2ba01df289070a92b0d714a1 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Thu, 11 Jan 2024 14:21:28 +0545 Subject: [PATCH] Added test for sending share invitation to deleted user --- .../features/apiGraph/createUser.feature | 2 +- .../features/apiGraph/editUser.feature | 2 +- .../apiSharingNg/shareInvitations.feature | 55 +++++++++++++++++++ .../features/bootstrap/GraphContext.php | 4 +- 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/features/apiGraph/createUser.feature b/tests/acceptance/features/apiGraph/createUser.feature index c95f6aff3a8..113bcee449a 100644 --- a/tests/acceptance/features/apiGraph/createUser.feature +++ b/tests/acceptance/features/apiGraph/createUser.feature @@ -81,7 +81,7 @@ Feature: create user Scenario: user can be created with the name of the deleted user Given user "Brian" has been created with default attributes and without skeleton files And the administrator has assigned the role "Admin" to user "Alice" using the Graph API - And the user "Alice" has deleted a user "Brian" using the Graph API + And the user "Alice" has deleted a user "Brian" When the user "Alice" creates a new user with the following attributes using the Graph API: | userName | Brian | | displayName | This is another Brian | diff --git a/tests/acceptance/features/apiGraph/editUser.feature b/tests/acceptance/features/apiGraph/editUser.feature index 32eae98ce39..6f1e353202d 100644 --- a/tests/acceptance/features/apiGraph/editUser.feature +++ b/tests/acceptance/features/apiGraph/editUser.feature @@ -102,7 +102,7 @@ Feature: edit user | displayName | sam | | email | sam@example.com | | password | 1234 | - And the user "Alice" has deleted a user "sam" using the Graph API + And the user "Alice" has deleted a user "sam" When the user "Alice" changes the user name of user "Brian" to "sam" using the Graph API Then the HTTP status code should be "200" And the user information of "sam" should match this JSON schema diff --git a/tests/acceptance/features/apiSharingNg/shareInvitations.feature b/tests/acceptance/features/apiSharingNg/shareInvitations.feature index 68a62709dfa..827c86299eb 100644 --- a/tests/acceptance/features/apiSharingNg/shareInvitations.feature +++ b/tests/acceptance/features/apiSharingNg/shareInvitations.feature @@ -924,3 +924,58 @@ Feature: Send a sharing invitations | Co Owner | folder | FolderToShare | | Uploader | folder | FolderToShare | | Manager | folder | FolderToShare | + + + Scenario Outline: send share invitation to deleted user + Given user "Alice" has uploaded file with content "to share" to "/textfile1.txt" + And user "Alice" has created folder "FolderToShare" + And the user "Admin" has deleted a user "Brian" + When user "Alice" sends the following share invitation using the Graph API: + | resourceType | | + | resource | | + | space | Personal | + | sharee | Brian | + | shareType | user | + | 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", + "pattern": "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 87af6bc26fa..729a492b452 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -431,7 +431,7 @@ public function theUserTriesToDeleteNonExistingUser(string $byUser): void { } /** - * @Given /^the user "([^"]*)" has deleted a user "([^"]*)" using the Graph API$/ + * @Given /^the user "([^"]*)" has deleted a user "([^"]*)"$/ * * @param string $byUser * @param string $user @@ -440,7 +440,7 @@ public function theUserTriesToDeleteNonExistingUser(string $byUser): void { * @throws Exception * @throws GuzzleException */ - public function theUserHasDeletesAUserUsingTheGraphAPI(string $byUser, string $user): void { + public function theUserHasDeletedAUser(string $byUser, string $user): void { $response = $this->adminDeletesUserUsingTheGraphApi($user, $byUser); $this->featureContext->theHttpStatusCodeShouldBe(204, "", $response); }