From a7cda6bb81e398654049bcfb22138f73d77ec380 Mon Sep 17 00:00:00 2001 From: prashant-gurung899 Date: Thu, 13 Jun 2024 16:39:56 +0545 Subject: [PATCH] add tests to create quick link of projectSpace Signed-off-by: prashant-gurung899 --- .../apiSharingNgLinkShare/linkShare.feature | 133 +++++++++++++++++- .../shareSubItemOfSpace.feature | 1 + .../features/bootstrap/SharingNgContext.php | 3 +- 3 files changed, 132 insertions(+), 5 deletions(-) diff --git a/tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature b/tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature index 733456800d..25becf2292 100644 --- a/tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature +++ b/tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature @@ -3315,7 +3315,7 @@ Feature: Create a share link for a resource } """ - + Scenario Outline: create a quick link share of a file using permissions endpoint Given user "Alice" has uploaded file with content "other data" to "textfile1.txt" When user "Alice" creates the following resource link share using the Graph API: @@ -3695,7 +3695,7 @@ Feature: Create a share link for a resource """ - Scenario Outline: create a quick link share of a project-space using permissions endpoint + Scenario Outline: create a quick link share of a project-space using permissions endpoint Given using spaces DAV path And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API And user "Alice" has created a space "projectSpace" with the default quota using the Graph API @@ -3761,7 +3761,7 @@ Feature: Create a share link for a resource | createOnly | | blocksDownload | - + Scenario: create an internal quick link share of a project-space using permissions endpoint Given using spaces DAV path And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API @@ -3817,4 +3817,129 @@ Feature: Create a share link for a resource } } } - """ \ No newline at end of file + """ + + + Scenario Outline: create quick link share of a project space drive using root endpoint + Given using spaces DAV path + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "projectSpace" with the default quota using the Graph API + When user "Alice" creates the following space link share using root endpoint of the Graph API: + | space | projectSpace | + | permissionsRole | | + | password | %public% | + | displayName | Link | + | quickLink | true | + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "hasPassword", + "id", + "link" + ], + "properties": { + "hasPassword": { + "const": true + }, + "id": { + "pattern": "^[a-zA-Z]{15}$" + }, + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "@libre.graph.displayName": { + "const": "Link" + }, + "@libre.graph.quickLink": { + "const": true + }, + "preventsDownload": { + "const": false + }, + "type": { + "const": "" + }, + "webUrl": { + "type": "string", + "pattern": "^%base_url%/s/[a-zA-Z]{15}$" + } + } + } + } + } + """ + Examples: + | permissions-role | + | view | + | upload | + | edit | + | createOnly | + + + Scenario: create an internal quick link share of a project space drive using root endpoint + Given using spaces DAV path + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "projectSpace" with the default quota using the Graph API + When user "Alice" creates the following space link share using root endpoint of the Graph API: + | space | projectSpace | + | permissionsRole | internal | + | displayName | Link | + | quickLink | true | + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "hasPassword", + "id", + "link" + ], + "properties": { + "hasPassword": { + "const": false + }, + "id": { + "pattern": "^[a-zA-Z]{15}$" + }, + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "@libre.graph.displayName": { + "const": "Link" + }, + "@libre.graph.quickLink": { + "const": true + }, + "preventsDownload": { + "const": false + }, + "type": { + "const": "internal" + }, + "webUrl": { + "type": "string", + "pattern": "^%base_url%/s/[a-zA-Z]{15}$" + } + } + } + } + } + """ diff --git a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature index 24d7a72149..741603903b 100644 --- a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature +++ b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature @@ -155,6 +155,7 @@ Feature: Share a file or folder that is inside a space And the information about the last share for user "Brian" should include | expiration | | + Scenario: user cannot delete share role Given using OCS API version "" And using SharingNG diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index 0bd676d1c2..b54140b4fa 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -124,12 +124,13 @@ class SharingNgContext implements Context { $space = $bodyRows['space']; $spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"]; - + $bodyRows['quickLink'] = $bodyRows['quickLink'] ?? false; $bodyRows['displayName'] = $bodyRows['displayName'] ?? null; $bodyRows['expirationDateTime'] = $bodyRows['expirationDateTime'] ?? null; $bodyRows['password'] = $bodyRows['password'] ?? null; $body = [ 'type' => $bodyRows['permissionsRole'], + "@libre.graph.quickLink" => filter_var($bodyRows['quickLink'], FILTER_VALIDATE_BOOLEAN), 'displayName' => $bodyRows['displayName'], 'expirationDateTime' => $bodyRows['expirationDateTime'], 'password' => $this->featureContext->getActualPassword($bodyRows['password'])