mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 11:19:39 -06:00
Merge pull request #8136 from owncloud/add-test-for-invite-user-with-wrong-recipient-type
[full-ci] [tests-only] Add test to send share invitation with wrong recipient type
This commit is contained in:
@@ -1222,7 +1222,7 @@ Feature: Send a sharing invitations
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string",
|
||||
"pattern": "generalException"
|
||||
"enum": ["generalException"]
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
@@ -1269,7 +1269,7 @@ Feature: Send a sharing invitations
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string",
|
||||
"pattern": "invalidRequest"
|
||||
"enum": ["invalidRequest"]
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
@@ -1286,3 +1286,103 @@ Feature: Send a sharing invitations
|
||||
| resource-type | path |
|
||||
| file | /textfile1.txt |
|
||||
| folder | FolderToShare |
|
||||
|
||||
|
||||
Scenario Outline: send share invitation to user with wrong recipient type
|
||||
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 |
|
||||
| sharee | Brian |
|
||||
| shareType | wrongShareType |
|
||||
| permissionsRole | Viewer |
|
||||
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",
|
||||
"enum": ["invalidRequest"]
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Key: 'DriveItemInvite.Recipients[0].LibreGraphRecipientType' Error:Field validation for 'LibreGraphRecipientType' failed on the 'oneof' tag"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| resource-type | path |
|
||||
| file | /textfile1.txt |
|
||||
| folder | FolderToShare |
|
||||
|
||||
|
||||
Scenario Outline: send share invitation to group with wrong recipient type
|
||||
Given user "Carol" has been created with default attributes and without skeleton files
|
||||
And user "Alice" has uploaded file with content "to share" to "textfile1.txt"
|
||||
And user "Alice" has created folder "FolderToShare"
|
||||
And group "grp1" has been created
|
||||
And the following users have been added to the following groups
|
||||
| username | groupname |
|
||||
| Brian | grp1 |
|
||||
| Carol | grp1 |
|
||||
When user "Alice" tries to send the following share invitation using the Graph API:
|
||||
| resourceType | <resource-type> |
|
||||
| resource | <path> |
|
||||
| space | Personal |
|
||||
| sharee | grp1 |
|
||||
| shareType | wrongShareType |
|
||||
| permissionsRole | Viewer |
|
||||
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",
|
||||
"enum": ["invalidRequest"]
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Key: 'DriveItemInvite.Recipients[0].LibreGraphRecipientType' Error:Field validation for 'LibreGraphRecipientType' failed on the 'oneof' tag"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| resource-type | path |
|
||||
| file | /textfile1.txt |
|
||||
| folder | FolderToShare |
|
||||
|
||||
@@ -163,12 +163,10 @@ class SharingNgContext implements Context {
|
||||
$sharees = array_map('trim', explode(',', $rows['sharee']));
|
||||
$shareTypes = array_map('trim', explode(',', $rows['shareType']));
|
||||
|
||||
foreach ($sharees as $index => $sharee) {
|
||||
$shareType = $shareTypes[$index];
|
||||
foreach ($sharees as $sharee) {
|
||||
// for non-exiting group or user, generate random id
|
||||
$shareeIds[] = (($shareType === 'user')
|
||||
? $this->featureContext->getAttributeOfCreatedUser($sharee, 'id')
|
||||
: $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id')) ?: WebDavHelper::generateUUIDv4();
|
||||
$shareeIds[] = $this->featureContext->getAttributeOfCreatedUser($sharee, 'id')
|
||||
?: ($this->featureContext->getAttributeOfCreatedGroup($sharee, 'id') ?: WebDavHelper::generateUUIDv4());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user