From dbea452b797bc49dec28047a40d2ca2b1ff68049 Mon Sep 17 00:00:00 2001 From: prashant-gurung899 Date: Mon, 19 Aug 2024 09:55:19 +0545 Subject: [PATCH] add test to check acivities by sharee Signed-off-by: prashant-gurung899 --- tests/acceptance/bootstrap/GraphContext.php | 34 +++++++++++++- .../apiActivities/shareActivities.feature | 45 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/bootstrap/GraphContext.php b/tests/acceptance/bootstrap/GraphContext.php index 856da67d92d..9515ad9c336 100644 --- a/tests/acceptance/bootstrap/GraphContext.php +++ b/tests/acceptance/bootstrap/GraphContext.php @@ -2808,7 +2808,39 @@ public function getPermissionRoleDefinitionUsingGraphAPI(string $user, string $p * @throws Exception */ public function userListsTheActivitiesForResourceOfSpaceUsingTheGraphAPI(string $user, string $resource, string $spaceName): void { - $resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource); + if ($spaceName === "Shares") { + $resourceId = GraphHelper::getShareMountId( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $user, + $this->featureContext->getPasswordForUser($user), + $resource + ); + } else { + $resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource); + } + $response = GraphHelper::getActivities( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $user, + $this->featureContext->getPasswordForUser($user), + $resourceId + ); + $this->featureContext->setResponse($response); + } + + /** + * @When user :user tries to list the activities of unshared file :file of user :user1 from space :spaceName using the Graph API + * + * @param string $user + * @param string $file + * @param string $user1 + * @param string $spaceName + * + * @return void + */ + public function userTriesToListActivitiesOfUnsharedFile(string $user, string $file, string $user1, string $spaceName): void { + $resourceId = $this->featureContext->spacesContext->getResourceId($user1, $spaceName, $file); $response = GraphHelper::getActivities( $this->featureContext->getBaseUrl(), $this->featureContext->getStepLineRef(), diff --git a/tests/acceptance/features/apiActivities/shareActivities.feature b/tests/acceptance/features/apiActivities/shareActivities.feature index 9fc5c7ef547..d8faebe956a 100644 --- a/tests/acceptance/features/apiActivities/shareActivities.feature +++ b/tests/acceptance/features/apiActivities/shareActivities.feature @@ -1076,3 +1076,48 @@ Feature: check share activity } } """ + + @issue-9849 + Scenario: sharee tries to check activities of folder using share mountpoint id + Given user "Alice" has created folder "/FOLDER" + And user "Alice" has sent the following resource share invitation: + | resource | /FOLDER | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor | + And user "Brian" has a share "/FOLDER" synced + And user "Brian" has uploaded file with content "some data" to "Shares/FOLDER/newfile.txt" + And user "Brian" has uploaded file with content "edited data" to "Shares/FOLDER/newfile.txt" + And user "Brian" has deleted file "Shares/FOLDER/newfile.txt" + When user "Brian" lists the activities for folder "FOLDER" of space "Shares" using the Graph API + 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", + "minItems": 0, + "maxItems": 0, + "uniqueItems": true, + "items": { + } + } + } + } + """ + + @issue-9849 + Scenario: sharee tries to check activities of another unshared file + Given user "Alice" has uploaded file with content "another ownCloud test text file" to "anotherTextfile.txt" + And user "Alice" has sent the following resource share invitation: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Brian" tries to list the activities of unshared file "anotherTextfile.txt" of user "Alice" from space "Personal" using the Graph API + Then the HTTP status code should be "403"