Skip to content

Commit

Permalink
adding test for creating link space share via permission endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Panta committed May 27, 2024
1 parent 7b47d55 commit eb2bd3e
Show file tree
Hide file tree
Showing 3 changed files with 396 additions and 4 deletions.
1 change: 0 additions & 1 deletion tests/TestHelpers/GraphHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,6 @@ public static function sendSharingInvitationForDrive(
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/root/invite");
$body = self::createShareInviteBody($shareeIds, $shareTypes, $permissionsRole, $permissionsAction, $expireDate);

return HttpRequestHelper::post(
$url,
$xRequestId,
Expand Down
371 changes: 371 additions & 0 deletions tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2300,3 +2300,374 @@ Feature: Create a share link for a resource
"""
And the public should be able to download file "textfile.txt" from the last link share with password "%public%" and the content should be "to share"
And the public download of file "textfile.txt" from the last link share with password "$heLlo*1234*" should fail with HTTP status code "401" using shareNg

@issue-7879
Scenario Outline: try to create a link share of a Personal and Share drive using permission endpoint
When user "Alice" tries to create the following space link share using permission endpoint of the Graph API:
| space | <drive> |
| permissionsRole | <permissions-role> |
| password | %public% |
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",
"innererror",
"message"
],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "<message>"
}
}
}
}
}
"""
Examples:
| permissions-role | drive | message |
| view | Shares | no share permission |
| edit | Shares | no share permission |
| upload | Shares | no share permission |
| createOnly | Shares | no share permission |
# | blocksDownload | Shares | invalid link type |
| view | Personal | cannot create link on personal space root |
| edit | Personal | cannot create link on personal space root |
| upload | Personal | cannot create link on personal space root |
| createOnly | Personal | cannot create link on personal space root |
# | blocksDownload | Personal | invalid link type |

@issue-7879
Scenario Outline: create a link share of a project-space drive with different permissions using permission 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 permission endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | <permissions-role> |
| password | %public% |
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": {
"type": "string",
"pattern": "^[a-zA-Z]{15}$"
},
"link": {
"type": "object",
"required": [
"@libre.graph.displayName",
"@libre.graph.quickLink",
"preventsDownload",
"type",
"webUrl"
],
"properties": {
"@libre.graph.displayName": {
"const": ""
},
"@libre.graph.quickLink": {
"const": false
},
"preventsDownload": {
"const": false
},
"type": {
"const": "<permissions-role>"
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
}
}
}
}
}
"""
Examples:
| permissions-role |
| view |
| edit |
| upload |
| createOnly |
# | blocksDownload |


Scenario Outline: try to create an internal link share of a Personal and Share drives using permission endpoint
When user "Alice" tries to create the following space link share using permission endpoint of the Graph API:
| space | <drive> |
| permissionsRole | internal |
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",
"innererror",
"message"
],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "<message>"
}
}
}
}
}
"""
Examples:
| drive | message |
| Personal | cannot create link on personal space root |
| Shares | no share permission |


Scenario Outline: try to create an internal link share with password of a Personal and Share drive using permission endpoint
When user "Alice" tries to create the following space link share using permission endpoint of the Graph API:
| space | <drive> |
| permissionsRole | internal |
| password | %public% |
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",
"innererror",
"message"
],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "password is redundant for the internal link"
}
}
}
}
}
"""
Examples:
| drive |
| Personal |
| Shares |


Scenario: create an internal link share of a project-space using permission 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 permission endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | internal |
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": ""
},
"@libre.graph.quickLink": {
"const": false
},
"preventsDownload": {
"const": false
},
"type": {
"const": "internal"
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
}
}
}
}
}
"""


Scenario: try to create an internal link share of a project-space drive with password using permission 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 permission endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | internal |
| password | %public% |
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",
"innererror",
"message"
],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "password is redundant for the internal link"
}
}
}
}
}
"""


Scenario Outline: create a link share of a project-space drive with different permissions using permission 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 permission endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | <permissions-role> |
| password | %public% |
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": {
"type": "string",
"pattern": "^[a-zA-Z]{15}$"
},
"link": {
"type": "object",
"required": [
"@libre.graph.displayName",
"@libre.graph.quickLink",
"preventsDownload",
"type",
"webUrl"
],
"properties": {
"@libre.graph.displayName": {
"const": ""
},
"@libre.graph.quickLink": {
"const": false
},
"preventsDownload": {
"const": false
},
"type": {
"const": "<permissions-role>"
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
}
}
}
}
}
"""
Examples:
| permissions-role |
| view |
| edit |
| upload |
| createOnly |
# | blocksDownload |
Loading

0 comments on commit eb2bd3e

Please sign in to comment.