[full-ci][tests-only]add tests coverage for removing expiration date from shares (#8490)

* add tests coverage for removing expiration date from share link

* add coverage for folder
This commit is contained in:
Amrita
2024-02-21 14:54:40 +05:45
committed by GitHub
parent d2d4fcd43b
commit c92ebf4b46
3 changed files with 151 additions and 6 deletions

View File

@@ -518,6 +518,77 @@ Feature: Create a share link for a resource
}
"""
@issues-8405
Scenario Outline: remove expiration date of a resource link share
Given user "Alice" has uploaded file with content "other data" to "textfile1.txt"
And user "Alice" has created folder "folder"
And user "Alice" has created the following link share:
| resource | <path> |
| space | Personal |
| permissionsRole | view |
| password | %public% |
| expirationDateTime | 2200-07-15T14:00:00.000Z |
When user "Alice" updates the last public link share using the Graph API with
| resource | <path> |
| space | Personal |
| expirationDateTime | |
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": {
"type": "boolean",
"enum": [true]
},
"id": {
"type": "string",
"pattern": "^[a-zA-Z]{15}$"
},
"link": {
"type": "object",
"minItems": 5,
"maxItems": 5,
"required": [
"@libre.graph.displayName",
"@libre.graph.quickLink",
"preventsDownload",
"type",
"webUrl"
],
"properties": {
"@libre.graph.quickLink": {
"type": "boolean",
"enum": [false]
},
"preventsDownload": {
"type": "boolean",
"enum": [false]
},
"type": {
"type": "string",
"enum": ["view"]
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%\/s\/[a-zA-Z]{15}$"
}
}
}
}
}
"""
Examples:
| path |
| textfile1.txt |
| folder |
@env-config
Scenario: set password on a file's link share
Given the following configs have been set:

View File

@@ -83,6 +83,80 @@ Feature: Update permission of a share
"""
Scenario Outline: user removes expiration date of a share
Given user "Alice" has uploaded file with content "hello world" to "testfile.txt"
And user "Alice" has created folder "folder"
And user "Alice" has sent the following share invitation:
| resource | <path> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
| expirationDateTime | 2025-07-15T14:00:00Z |
When user "Alice" updates the last share with the following using the Graph API:
| space | Personal |
| resource | <path> |
| expirationDateTime | |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"minItems": 3,
"maxItems": 3,
"required": [
"grantedToV2",
"id",
"roles"
],
"properties": {
"grantedToV2": {
"type": "object",
"required": [
"user"
],
"properties":{
"user": {
"type": "object",
"required": [
"displayName",
"id"
],
"properties": {
"displayName": {
"type": "string",
"enum": ["Brian Murphy"]
},
"id": {
"type": "string",
"pattern": "^%user_id_pattern%$"
}
}
}
}
},
"id": {
"type": "string",
"pattern": "^%permissions_id_pattern%$"
},
"roles": {
"type": "array",
"items": [
{
"type": "string",
"pattern": "^%role_id_pattern%$"
}
]
}
}
}
"""
Examples:
| path |
| testfile.txt |
| folder |
Scenario Outline: user updates role of a share
Given user "Alice" has uploaded file with content "to share" to "/textfile1.txt"
And user "Alice" has created folder "FolderToShare"
@@ -157,4 +231,4 @@ Feature: Update permission of a share
| Editor | FolderToShare | Viewer |
| Editor | FolderToShare | Uploader |
| Uploader | FolderToShare | Editor |
| Uploader | FolderToShare | Viewer |
| Uploader | FolderToShare | Viewer |

View File

@@ -262,11 +262,11 @@ class SharingNgContext implements Context {
$body = [];
if (\array_key_exists('permissionsRole', $bodyRows)) {
$body["roles"] = [GraphHelper::getPermissionsRoleIdByName($bodyRows['permissionsRole'])];
$body['roles'] = [GraphHelper::getPermissionsRoleIdByName($bodyRows['permissionsRole'])];
}
if (\array_key_exists('expirationDateTime', $bodyRows)) {
$body["expirationDateTime"] = $bodyRows['expirationDateTime'];
$body['expirationDateTime'] = empty($bodyRows['expirationDateTime']) ? null : $bodyRows['expirationDateTime'];
}
return GraphHelper::updateShare(
@@ -357,16 +357,16 @@ class SharingNgContext implements Context {
$bodyRows = $body->getRowsHash();
$space = $bodyRows['space'];
$resource = $bodyRows['resource'];
$spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"];
$spaceId = ($this->spacesContext->getSpaceByName($user, $space))['id'];
$itemId = $this->spacesContext->getResourceId($user, $space, $resource);
$body = [];
if (\array_key_exists('permissionsRole', $bodyRows)) {
$body["link"]["type"] = $bodyRows['permissionsRole'];
$body['link']['type'] = $bodyRows['permissionsRole'];
}
if (\array_key_exists('expirationDateTime', $bodyRows)) {
$body["expirationDateTime"] = $bodyRows['expirationDateTime'];
$body['expirationDateTime'] = empty($bodyRows['expirationDateTime']) ? null : $bodyRows['expirationDateTime'];
}
return GraphHelper::updateShare(