Skip to content

Commit

Permalink
Added test for sharingNg for endpoint sharedByMe
Browse files Browse the repository at this point in the history
Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>

Added tests for list shared by me

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>

adding test for updating permission of a share

Added test for sharingNg for endpoint sharedByMe

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>

Added tests for list shared by me

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>

adding test for updating permission of a share

adding test for updating role of a share
  • Loading branch information
SagarGi authored and nirajacharya2 committed Feb 5, 2024
1 parent 4d5490a commit 7c8b4d4
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 1 deletion.
80 changes: 79 additions & 1 deletion tests/acceptance/features/apiSharingNg/sharedByMe.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1533,4 +1533,82 @@ Feature: resources shared by user
}
}
}
"""
"""


@issue-8131
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"
And user "Alice" has sent the following share invitation:
| resource | <path> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
When user "Alice" updates the last share with the following using the Graph API:
| updatedRole | <updated-role> |
| space | Personal |
| resource | <path> |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"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:
| permissions-role | path | updated-role |
| Viewer | textfile1.txt | File Editor |
| File Editor | textfile1.txt | Viewer |
| Viewer | FolderToShare | Uploader |
| Viewer | FolderToShare | Editor |
| Editor | FolderToShare | Viewer |
| Editor | FolderToShare | Uploader |
| Uploader | FolderToShare | Editor |
| Uploader | FolderToShare | Viewer |
6 changes: 6 additions & 0 deletions tests/acceptance/features/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,12 @@ public function updateShare(string $user, TableNode $body, string $permissionID
"type" => $bodyRows['permissionsRole']
]
];
} elseif (\array_key_exists('updatedRole', $bodyRows)) {
$body = [
"roles" => [
GraphHelper::getPermissionsRoleIdByName($bodyRows['updatedRole'])
]
];
} elseif (\array_key_exists('permissionsRole', $bodyRows)) {
$body = [
"link" => [
Expand Down

0 comments on commit 7c8b4d4

Please sign in to comment.