added test to share space with different roles (#8304)

This commit is contained in:
Prajwol Amatya
2024-01-30 13:57:03 +05:45
committed by GitHub
parent fcd82619b3
commit b71cdd7004
3 changed files with 79 additions and 4 deletions

View File

@@ -1811,7 +1811,7 @@ class GraphHelper {
$body
);
}
/**
* @param string $baseUrl
* @param string $xRequestId

View File

@@ -1589,3 +1589,78 @@ Feature: Send a sharing invitations
| resource-type | path |
| file | /textfile1.txt |
| folder | FolderToShare |
Scenario Outline: send share invitation for project space to user with different roles
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 "NewSpace" with the default quota using the Graph API
When user "Alice" sends the following share invitation for space using the Graph API:
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"value"
],
"properties": {
"value": {
"type": "array",
"items": {
"type": "object",
"required": [
"grantedToV2",
"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%$"
}
}
}
}
},
"roles": {
"type": "array",
"items": {
"type": "string",
"pattern": "^%role_id_pattern%$"
}
}
}
}
}
}
}
"""
Examples:
| permissions-role |
| Space Viewer |
| Space Editor |
| Co Owner |
| Manager |

View File

@@ -151,9 +151,8 @@ class SharingNgContext implements Context {
$rows['resource']
);
} else {
$itemId = ($rows['resourceType'] === 'folder')
? $this->spacesContext->getResourceId($user, $rows['space'], $rows['resource'])
: $this->spacesContext->getFileId($user, $rows['space'], $rows['resource']);
$resource = $rows['resource'] ?? '';
$itemId = $this->spacesContext->getResourceId($user, $rows['space'], $resource);
}
if (\array_key_exists('shareeId', $rows)) {
@@ -211,6 +210,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:$/
* @When user :user sends the following share invitation for space using the Graph API:
*
* @param string $user
* @param TableNode $table