add tests to create quick link of projectSpace

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899
2024-06-13 16:39:56 +05:45
parent 1a6183abbe
commit a7cda6bb81
3 changed files with 132 additions and 5 deletions

View File

@@ -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
}
}
}
"""
"""
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 | <permissions-role> |
| 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": "<permissions-role>"
},
"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}$"
}
}
}
}
}
"""

View File

@@ -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 "<ocs_api_version>"
And using SharingNG

View File

@@ -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'])