8000 [tests-only][full-ci] add test for list single sharing permission for a drive by nabim777 · Pull Request #11337 · owncloud/ocis · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[tests-only][full-ci] add test for list single sharing permission for a drive #11337

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

Merged
merged 1 commit into from
Jun 3, 2025
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
26 changes: 26 additions & 0 deletions tests/acceptance/TestHelpers/GraphHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2059,6 +2059,32 @@ public static function getDrivePermissionsList(
);
}

/**
* @param string $baseUrl
* @param string $user
* @param string $password
* @param string $spaceId
* @param string $permissionId
*
* @return ResponseInterface
* @throws GuzzleException
*/
public static function getSingleDrivePermission(
string $baseUrl,
string $user,
string $password,
string $spaceId,
string $permissionId
): ResponseInterface {
8000 $url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/root/permissions/$permissionId");
return HttpRequestHelper::get(
$url,
$user,
$password,
self::getRequestHeaders()
);
}

/**
* @param string $baseUrl
* @param string $user
Expand Down
52 changes: 52 additions & 0 deletions tests/acceptance/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1766,6 +1766,58 @@ public function userListsThePermissionsOfDriveUsingRootEndPointOFTheGraphApi(str
$this->featureContext->setResponse($response);
}

/**
* @When /^user "([^"]*)" lists the permission of space "([^"]*)" shared to user "([^"]*)" using root endpoint of the Graph API$/
*
* @param string $user
* @param string $space
* @param string $sharee
*
* @return void
* @throws Exception
* @throws GuzzleException
*
*/
public function userListDrivePermissionViaRootEndpointGraphApi(string $user, string $space, string $sharee): void {
$spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"];
$permissionID = "u:" . $this->featureContext->getAttributeOfCreatedUser($sharee, 'id');
$response = GraphHelper::getSingleDrivePermissionList(
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$spaceId,
$permissionID
);
$this->featureContext->setResponse($response);
}

/**
* @When /^user "([^"]*)" lists the last link permission of space "([^"]*)" using root endpoint of the Graph API$/
*
* @param string $user
* @param string $space
*
* @return void
* @throws Exception
* @throws GuzzleException
*
*/
public function userListsPermissionOfSpaceSharedViaLinkUsingRootEndpointGraphApi(
string $user,
string $space
): void {
$spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"];
$permissionId = $this->featureContext->shareNgGetLastCreatedLinkShareID();
$response = GraphHelper::getSingleDrivePermission(
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$spaceId,
$permissionId
);
$this->featureContext->setResponse($response);
}

/**
* @When /^user "([^"]*)" (?:tries to send|sends) the following space share invitation using root endpoint of the Graph API:$/
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ The expected failures in this file are from features in the owncloud/ocis repo.
### [[Sharing NG] Implement https://owncloud.dev/libre-graph-api/#/drives.permissions/GetPermission](https://github.com/owncloud/ocis/issues/8616)
- [apiSharingNgPermissions/listPermissions.feature:2585](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNgPermissions/listPermissions.feature#L2585)
- [apiSharingNgPermissions/listPermissions.feature:2631](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNgPermissions/listPermissions.feature#L2631)
- [apiSharingNgPermissions/listPermissions.feature:2673](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNgPermissions/listPermissions.feature#L2673)
- [apiSharingNgPermissions/listPermissions.feature:2718](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNgPermissions/listPermissions.feature#L2718)

Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.
Original file line number Diff line number Diff line change
Expand Up @@ -2668,3 +2668,91 @@ Feature: List a sharing permissions
}
}
"""

@issue-8616
Scenario: sharer lists single membership permission of a project space using root endpoint
Given using spaces DAV path
And user "Brian" has been created with default attributes
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "new-space" with the default quota using the Graph API
And user "Alice" has sent the following space share invitation:
| space | new-space |
| sharee | Brian |
| shareType | user |
| permissionsRole | Space Viewer |
When user "Alice" lists the permission of space "new-space" shared to user "Brian" using root endpoint of the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["id", "roles", "grantedToV2"],
"properties": {
"id": { "pattern": "^u:%user_id_pattern%$" },
"roles": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {"pattern": "^%role_id_pattern%$"}
},
"grantedToV2": {
"type": "object",
"required": ["user"],
"properties": {
"user": {
"type": "object",
"required": ["@libre.graph.userType", "displayName", "id"],
"properties": {
"@libre.graph.userType": {"const": "Member"},
"id": {"pattern": "^%user_id_pattern%$"},
"displayName": {"const": "Brian Murphy"}
}
}
}
}
}
}
"""

@issue-8616
Scenario: sharer lists single link permission of a project space using root endpoint
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 "new-space" with the default quota using the Graph API
And user "Alice" has created the following space link share:
| space | new-space |
| permissionsRole | View |
| password | %public% |
When user "Alice" lists the last link permission of space "Personal" using root endpoint of the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["createdDateTime", "hasPassword", "id", "link"],
"properties": {
"createdDateTime": {
"format": "date-time"
},
"hasPassword": { "const": true},
"id": {"pattern": "^[a-zA-Z]{15}$"},
"link": {
"type": "object",
"required": [
"@libre.graph.displayName",
"@libre.graph.quickLink",
"preventsDownload",
"type",
"webUrl"
],
"properties": {
"@libre.graph.displayName": {"const": ""},
"@libre.graph.quickLink": {"const": false},
"preventsDownload": {"const": false},
"type": {"const": "view"},
"webUrl": {"pattern": "^%base_url%/s/[a-zA-Z]{15}$"}
}
}
}
}
"""
0