Skip to content

Commit

Permalink
add tests for update permission
Browse files Browse the repository at this point in the history
  • Loading branch information
amrita-shrestha committed Apr 19, 2024
1 parent 1c2700e commit b81742b
Show file tree
Hide file tree
Showing 4 changed files with 490 additions and 56 deletions.
34 changes: 34 additions & 0 deletions tests/TestHelpers/GraphHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2042,4 +2042,38 @@ public static function sendSharingInvitationForDriveRoot(
\json_encode($body)
);
}

/**
* @param string $baseUrl
* @param string $xRequestId
* @param string $user
* @param string $password
* @param string $spaceId
* @param mixed $body
* @param string $permissionsId
*
* @return ResponseInterface
* @throws GuzzleException
*/
public static function updateShareOfDrive(
string $baseUrl,
string $xRequestId,
string $user,
string $password,
string $spaceId,
$body,
string $permissionsId
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/root/permissions/$permissionsId");

return HttpRequestHelper::sendRequestOnce(
$url,
$xRequestId,
'PATCH',
$user,
$password,
self::getRequestHeaders(),
$body
);
}
}
91 changes: 53 additions & 38 deletions tests/acceptance/features/apiSharingNg/shareInvitations.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1837,9 +1837,14 @@ Feature: Send a sharing invitations
"type": "object",
"required": [
"grantedToV2",
"roles"
"roles",
"id"
],
"properties": {
"id": {
"type": "string",
"pattern": "^g:%groupd_id_pattern%$"
},
"grantedToV2": {
"type": "object",
"required": [
Expand Down Expand Up @@ -2402,7 +2407,7 @@ Feature: Send a sharing invitations
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
"""
{
"type": "object",
"required": [
Expand All @@ -2416,10 +2421,24 @@ Feature: Send a sharing invitations
"items": {
"type": "object",
"required": [
"grantedToV2",
"roles"
"id",
"roles",
"grantedToV2"
],
"properties": {
"id": {
"type": "string",
"pattern": "^u:%user_id_pattern%$"
},
"roles": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "string",
"pattern": "^%role_id_pattern%$"
}
},
"grantedToV2": {
"type": "object",
"required": [
Expand All @@ -2429,32 +2448,23 @@ Feature: Send a sharing invitations
"user": {
"type": "object",
"required": [
"displayName",
"id"
"id",
"displayName"
],
"properties": {
"id": {
"type": "string",
"pattern": "^%group_id_pattern%$"
},
"displayName": {
"type": "string",
"enum": [
"Brian Murphy"
]
},
"id": {
"type": "string",
"pattern": "^%user_id_pattern%$"
}
}
}
}
},
"roles": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "string",
"pattern": "^%role_id_pattern%$"
}
}
}
}
Expand Down Expand Up @@ -2484,7 +2494,7 @@ Feature: Send a sharing invitations
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
"""
{
"type": "object",
"required": [
Expand All @@ -2498,45 +2508,50 @@ Feature: Send a sharing invitations
"items": {
"type": "object",
"required": [
"grantedToV2",
"roles"
"id",
"roles",
"grantedToV2"
],
"properties": {
"id": {
"type": "string",
"pattern": "^g:%group_id_pattern%$"
},
"roles": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "string",
"pattern": "^%role_id_pattern%$"
}
},
"grantedToV2": {
"type": "object",
"required": [
"group"
],
"properties": {
"user": {
"group": {
"type": "object",
"required": [
"displayName",
"id"
"id",
"displayName"
],
"properties": {
"id": {
"type": "string",
"pattern": "^%group_id_pattern%$"
},
"displayName": {
"type": "string",
"enum": [
"grp1"
]
},
"id": {
"type": "string",
"pattern": "^%user_id_pattern%$"
}
}
}
}
},
"roles": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "string",
"pattern": "^%role_id_pattern%$"
}
}
}
}
Expand Down

0 comments on commit b81742b

Please sign in to comment.