Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test-only] [back-port] Change naming in sharingNG api-tests #8159

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions tests/TestHelpers/GraphHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function getSpaceIdRegex(): string {
/**
* @return string
*/
public static function getShareIdRegex(): string {
public static function getPermissionsIdRegex(): string {
return self::getUUIDv4Regex() . ':' . self::getUUIDv4Regex() . ':' . self::getUUIDv4Regex();
}

Expand Down Expand Up @@ -1543,16 +1543,16 @@ public static function getPermissionsList(
/**
* Get the role id by name
*
* @param string $role
* @param string $permissionsRole
*
* @return string
*
* @throws \Exception
*/
public static function getRoleIdByName(
string $role
public static function getPermissionsRoleIdByName(
string $permissionsRole
): string {
switch ($role) {
switch ($permissionsRole) {
case 'Viewer':
return 'b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5';
case 'Space Viewer':
Expand All @@ -1570,7 +1570,7 @@ public static function getRoleIdByName(
case 'Manager':
return '312c0871-5ef7-4b3a-85b6-0e4074c64049';
default:
throw new \Exception('Role ' . $role . ' not found');
throw new \Exception('Role ' . $permissionsRole . ' not found');
}
}

Expand All @@ -1583,8 +1583,8 @@ public static function getRoleIdByName(
* @param string $itemId
* @param string $shareeId
* @param string $shareType
* @param string|null $role
* @param string|null $permission
* @param string|null $permissionsRole
* @param string|null $permissionsAction
* @param string|null $expireDate
*
* @return ResponseInterface
Expand All @@ -1600,8 +1600,8 @@ public static function sendSharingInvitation(
string $itemId,
string $shareeId,
string $shareType,
?string $role,
?string $permission,
?string $permissionsRole,
?string $permissionsAction,
?string $expireDate
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/invite");
Expand All @@ -1612,13 +1612,13 @@ public static function sendSharingInvitation(

$body['recipients'] = [$recipients];

if ($role !== null) {
$roleId = self::getRoleIdByName($role);
if ($permissionsRole !== null) {
$roleId = self::getPermissionsRoleIdByName($permissionsRole);
$body['roles'] = [$roleId];
}

if ($permission !== null) {
$body['@libre.graph.permissions.actions'] = ['libre.graph/driveItem/' . $permission];
if ($permissionsAction !== null) {
$body['@libre.graph.permissions.actions'] = ['libre.graph/driveItem/' . $permissionsAction];
}

if ($expireDate !== null) {
Expand Down Expand Up @@ -1675,7 +1675,7 @@ public static function createLinkShare(
* @param string $spaceId
* @param string $itemId
* @param mixed $body
* @param string $shareId
* @param string $permissionsId
*
* @return ResponseInterface
* @throws GuzzleException
Expand All @@ -1688,9 +1688,9 @@ public static function updateLinkShare(
string $spaceId,
string $itemId,
$body,
string $shareId
string $permissionsId
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/permissions/$shareId");
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/permissions/$permissionsId");
return HttpRequestHelper::sendRequestOnce(
$url,
$xRequestId,
Expand All @@ -1710,7 +1710,7 @@ public static function updateLinkShare(
* @param string $spaceId
* @param string $itemId
* @param mixed $body
* @param string $shareId
* @param string $permissionsId
*
* @return ResponseInterface
* @throws GuzzleException
Expand All @@ -1723,9 +1723,9 @@ public static function setPassword(
string $spaceId,
string $itemId,
$body,
string $shareId
string $permissionsId
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/permissions/$shareId/setPassword");
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/permissions/$permissionsId/setPassword");
return HttpRequestHelper::post(
$url,
$xRequestId,
Expand Down
128 changes: 64 additions & 64 deletions tests/acceptance/features/apiSharingNg/deletePermissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ Feature: Remove access to a drive item
Given user "Alice" has created folder "FolderToShare"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile.txt"
And user "Alice" has sent the following share invitation:
| resourceType | <resource-type> |
| resource | <path> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| role | <role> |
| resourceType | <resource-type> |
| resource | <path> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissionsRole> |
When user "Alice" removes the share permission of user "Brian" from <resource-type> "<path>" of space "Personal" using the Graph API
Then the HTTP status code should be "204"
And for user "Brian" the space "Shares" should not contain these entries:
| <path> |
Examples:
| role | resource-type | path |
| Viewer | file | textfile.txt |
| File Editor | file | textfile.txt |
| Co Owner | file | textfile.txt |
| Manager | file | textfile.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |
| permissionsRole | resource-type | path |
| Viewer | file | textfile.txt |
| File Editor | file | textfile.txt |
| Co Owner | file | textfile.txt |
| Manager | file | textfile.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |


Scenario Outline: user removes access to resource inside of a project space in the user share
Expand All @@ -42,27 +42,27 @@ Feature: Remove access to a drive item
And user "Alice" has created a folder "FolderToShare" in space "NewSpace"
And user "Alice" has uploaded a file inside space "NewSpace" with content "some content" to "textfile.txt"
And user "Alice" has sent the following share invitation:
| resourceType | <resource-type> |
| resource | <path> |
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| role | <role> |
| resourceType | <resource-type> |
| resource | <path> |
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissionsRole> |
When user "Alice" removes the share permission of user "Brian" from <resource-type> "<path>" of space "NewSpace" using the Graph API
Then the HTTP status code should be "204"
And for user "Brian" the space "Shares" should not contain these entries:
| <path> |
Examples:
| role | resource-type | path |
| Viewer | file | textfile.txt |
| File Editor | file | textfile.txt |
| Co Owner | file | textfile.txt |
| Manager | file | textfile.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |
| permissionsRole | resource-type | path |
| Viewer | file | textfile.txt |
| File Editor | file | textfile.txt |
| Co Owner | file | textfile.txt |
| Manager | file | textfile.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |


Scenario Outline: user removes access to a resource in a group share
Expand All @@ -72,27 +72,27 @@ Feature: Remove access to a drive item
And user "Alice" has created folder "FolderToShare"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile.txt"
And user "Alice" has sent the following share invitation:
| resourceType | <resource-type> |
| resource | <path> |
| space | Personal |
| sharee | group1 |
| shareType | group |
| role | <role> |
| resourceType | <resource-type> |
| resource | <path> |
| space | Personal |
| sharee | group1 |
| shareType | group |
| permissionsRole | <permissionsRole> |
When user "Alice" removes the share permission of group "group1" from <resource-type> "<path>" of space "Personal" using the Graph API
Then the HTTP status code should be "204"
And for user "Brian" the space "Shares" should not contain these entries:
| <path> |
Examples:
| role | resource-type | path |
| Viewer | file | textfile.txt |
| File Editor | file | textfile.txt |
| Co Owner | file | textfile.txt |
| Manager | file | textfile.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |
| permissionsRole | resource-type | path |
| Viewer | file | textfile.txt |
| File Editor | file | textfile.txt |
| Co Owner | file | textfile.txt |
| Manager | file | textfile.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |


Scenario Outline: user removes access to a resource inside of a project space in group share
Expand All @@ -104,24 +104,24 @@ Feature: Remove access to a drive item
And user "Brian" has been added to group "group1"
And user "Alice" has been added to group "group1"
And user "Alice" has sent the following share invitation:
| resourceType | <resource-type> |
| resource | <path> |
| space | NewSpace |
| sharee | group1 |
| shareType | group |
| role | <role> |
| resourceType | <resource-type> |
| resource | <path> |
| space | NewSpace |
| sharee | group1 |
| shareType | group |
| permissionsRole | <permissionsRole> |
When user "Alice" removes the share permission of group "group1" from <resource-type> "<path>" of space "NewSpace" using the Graph API
Then the HTTP status code should be "204"
And for user "Brian" the space "Shares" should not contain these entries:
| <path> |
Examples:
| role | resource-type | path |
| Viewer | file | textfile.txt |
| File Editor | file | textfile.txt |
| Co Owner | file | textfile.txt |
| Manager | file | textfile.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |
| permissionsRole | resource-type | path |
| Viewer | file | textfile.txt |
| File Editor | file | textfile.txt |
| Co Owner | file | textfile.txt |
| Manager | file | textfile.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |
Loading