Skip to content

Commit

Permalink
change naming in test (owncloud#8140)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScharfViktor authored and 2403905 committed Jan 24, 2024
1 parent 85e749b commit ff7d925
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 211 deletions.
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 setLinkSharePassword(
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
Loading

0 comments on commit ff7d925

Please sign in to comment.