tests: add test for list single permission
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
This commit is contained in:
4 files changed
+168
No files matched your search
@@ -2059,6 +2059,32 @@ class GraphHelper {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 {
|
||||
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/root/permissions/$permissionId");
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $user
|
||||
|
||||
@@ -1766,6 +1766,58 @@ class SharingNgContext implements Context {
|
||||
$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:$/
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
@@ -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}$"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Reference in new issue
Block a user