mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-12 14:30:19 -05:00
Added test for sending share invitation to wrong objectId
This commit is contained in:
@@ -1192,3 +1192,53 @@ Feature: Send a sharing invitations
|
||||
| Viewer | folder | FolderToShare |
|
||||
| Editor | folder | FolderToShare |
|
||||
| Uploader | folder | FolderToShare |
|
||||
|
||||
|
||||
Scenario Outline: send share invitation to wrong user id with different roles
|
||||
Given user "Alice" has uploaded file with content "to share" to "/textfile1.txt"
|
||||
And user "Alice" has created folder "FolderToShare"
|
||||
When user "Alice" tries to send the following share invitation using the Graph API:
|
||||
| resourceType | <resource-type> |
|
||||
| resource | <path> |
|
||||
| space | Personal |
|
||||
| shareeId | a4c0c83e-ae24-4870-93c3-fcaf2a2228f7 |
|
||||
| shareType | user |
|
||||
| permissionsRole | <permissions-role> |
|
||||
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",
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string",
|
||||
"pattern": "generalException"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"itemNotFound: not found"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| permissions-role | resource-type | path |
|
||||
| Viewer | file | /textfile1.txt |
|
||||
| File Editor | file | /textfile1.txt |
|
||||
| Viewer | folder | FolderToShare |
|
||||
| Editor | folder | FolderToShare |
|
||||
| Uploader | folder | FolderToShare |
|
||||
|
||||
@@ -156,16 +156,20 @@ class SharingNgContext implements Context {
|
||||
: $this->spacesContext->getFileId($user, $rows['space'], $rows['resource']);
|
||||
}
|
||||
|
||||
$sharees = array_map('trim', explode(',', $rows['sharee']));
|
||||
$shareTypes = array_map('trim', explode(',', $rows['shareType']));
|
||||
if (\array_key_exists('shareeId', $rows)) {
|
||||
$shareeIds[] = $rows['shareeId'];
|
||||
$shareTypes[] = $rows['shareType'];
|
||||
} else {
|
||||
$sharees = array_map('trim', explode(',', $rows['sharee']));
|
||||
$shareTypes = array_map('trim', explode(',', $rows['shareType']));
|
||||
|
||||
$shareeIds = [];
|
||||
foreach ($sharees as $index => $sharee) {
|
||||
$shareType = $shareTypes[$index];
|
||||
// for non-exiting group or user, generate random id
|
||||
$shareeIds[] = (($shareType === 'user')
|
||||
? $this->featureContext->getAttributeOfCreatedUser($sharee, 'id')
|
||||
: $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id')) ?: WebDavHelper::generateUUIDv4();
|
||||
foreach ($sharees as $index => $sharee) {
|
||||
$shareType = $shareTypes[$index];
|
||||
// for non-exiting group or user, generate random id
|
||||
$shareeIds[] = (($shareType === 'user')
|
||||
? $this->featureContext->getAttributeOfCreatedUser($sharee, 'id')
|
||||
: $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id')) ?: WebDavHelper::generateUUIDv4();
|
||||
}
|
||||
}
|
||||
|
||||
$permissionsRole = $rows['permissionsRole'] ?? null;
|
||||
@@ -208,6 +212,7 @@ class SharingNgContext implements Context {
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends the following share invitation using the Graph API:$/
|
||||
* @When /^user "([^"]*)" tries to send the following share invitation using the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
|
||||
Reference in New Issue
Block a user