From 7deef3a8b5ef085d11f3310e2d2bc514bd53f067 Mon Sep 17 00:00:00 2001 From: amrita Date: Mon, 7 Apr 2025 16:30:48 +0545 Subject: [PATCH] add list activites tests for shared resource --- tests/acceptance/bootstrap/GraphContext.php | 6 +- .../listGrantsShareRole.feature | 122 ++++++++++++++++++ 2 files changed, 127 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/bootstrap/GraphContext.php b/tests/acceptance/bootstrap/GraphContext.php index cad308470f2..9e9ea80b69a 100644 --- a/tests/acceptance/bootstrap/GraphContext.php +++ b/tests/acceptance/bootstrap/GraphContext.php @@ -2934,7 +2934,11 @@ class GraphContext implements Context { string $resource, string $spaceName ): void { - $resourceId = $this->spacesContext->getResourceId($user, $spaceName, $resource); + if ($spaceName === "Shares") { + $resourceId = $this->spacesContext->getSharesRemoteItemId($user, $resource); + } else { + $resourceId = $this->spacesContext->getResourceId($user, $spaceName, $resource); + } $response = GraphHelper::getActivities( $this->featureContext->getBaseUrl(), $this->featureContext->getStepLineRef(), diff --git a/tests/acceptance/features/apiSharingNgAdditionalShareRole/listGrantsShareRole.feature b/tests/acceptance/features/apiSharingNgAdditionalShareRole/listGrantsShareRole.feature index 5bd1d3aa561..61aabb8ebd8 100644 --- a/tests/acceptance/features/apiSharingNgAdditionalShareRole/listGrantsShareRole.feature +++ b/tests/acceptance/features/apiSharingNgAdditionalShareRole/listGrantsShareRole.feature @@ -1482,3 +1482,125 @@ Feature: ListGrants role | permissions-role | | Viewer With ListGrants | | File Editor With ListGrants | + + + Scenario Outline: list activities of folder shared with listGrant roles (Personal space) + Given the administrator has enabled the permissions role "" + And using spaces DAV path + And using SharingNG + And 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 | | + And user "Brian" has a share "folder" synced + When user "Brian" lists the activities of folder "folder" from 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": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": {"pattern": "^%user_id_pattern%$"}, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": {"const": "{user} added {resource} to {folder}"}, + "variables":{ + "type": "object", + "required": ["folder","resource","user"], + "properties": { + "folder": { + "type": "object", + "required": ["id","name"], + "properties":{ + "id": {"const": ""}, + "name": {"const": "shared-with-me"} + } + }, + "resource": { + "type": "object", + "required": ["id","name"], + "properties": {"name": {"const": "folder"}} + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties":{"displayName": {"const": "Alice Hansen"}} + } + } + } + } + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": {"pattern": "^%user_id_pattern%$"}, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": {"const": "{user} shared {resource} with {sharee}"}, + "variables": { + "type": "object", + "required": ["folder","resource","sharee","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id","name"], + "properties": {"name": {"const": "folder"}} + }, + "sharee": { + "type": "object", + "required": ["id","displayName"], + "properties": {"displayName": {"const": "Brian"}} + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": {"displayName": {"const": "Alice Hansen"}} + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ + Examples: + | permissions-role | + | Viewer With ListGrants | + | Editor With ListGrants |