adding test for listing permission of project space by a user who is not a member of the space (#8927)

This commit is contained in:
nirajacharya2
2024-04-24 18:07:31 +05:45
committed by GitHub
parent 78ba483784
commit 30cb3729d4
2 changed files with 68 additions and 0 deletions
@@ -1094,3 +1094,45 @@ Feature: List a sharing permissions
| space | new-space |
| sharee | Brian |
| shareType | user |
Scenario: non-member user tries to list the permissions of a project space using permissions endpoint
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has created a space "new-space" with the default quota using the Graph API
When user "Brian" tries to list the permissions of space "new-space" owned by "Alice" using permissions endpoint of the Graph API
Then the HTTP status code should be "404"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["error"],
"properties": {
"error": {
"type": "object",
"required": [
"code",
"innererror",
"message"
],
"properties": {
"code": {
"const": "itemNotFound"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"type": "string",
"pattern": "stat: error: not found: %file_id_pattern%$"
}
}
}
}
}
"""
@@ -152,6 +152,32 @@ class SharingNgContext implements Context {
);
}
/**
* @When /^user "([^"]*)" tries to list the permissions of space "([^"]*)" owned by "([^"]*)" using permissions endpoint of the Graph API$/
*
* @param string $user
* @param string $space
* @param string $spaceOwner
*
* @return void
* @throws Exception
*/
public function userTriesToListThePermissionsOfSpaceUsingPermissionsEndpointOfTheGraphApi(string $user, string $space, string $spaceOwner):void {
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
$itemId = $this->spacesContext->getResourceId($spaceOwner, $space, '');
$this->featureContext->setResponse(
GraphHelper::getPermissionsList(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$spaceId,
$itemId
)
);
}
/**
* @param string $user
* @param TableNode $table