Skip to content

Commit

Permalink
add test to check acivities by sharee
Browse files Browse the repository at this point in the history
Signed-off-by: prashant-gurung899 <[email protected]>
  • Loading branch information
prashant-gurung899 committed Sep 23, 2024
1 parent 10a6711 commit dbea452
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 1 deletion.
34 changes: 33 additions & 1 deletion tests/acceptance/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2808,7 +2808,39 @@ public function getPermissionRoleDefinitionUsingGraphAPI(string $user, string $p
* @throws Exception
*/
public function userListsTheActivitiesForResourceOfSpaceUsingTheGraphAPI(string $user, string $resource, string $spaceName): void {
$resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource);
if ($spaceName === "Shares") {
$resourceId = GraphHelper::getShareMountId(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$resource
);
} else {
$resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource);
}
$response = GraphHelper::getActivities(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$resourceId
);
$this->featureContext->setResponse($response);
}

/**
* @When user :user tries to list the activities of unshared file :file of user :user1 from space :spaceName using the Graph API
*
* @param string $user
* @param string $file
* @param string $user1
* @param string $spaceName
*
* @return void
*/
public function userTriesToListActivitiesOfUnsharedFile(string $user, string $file, string $user1, string $spaceName): void {
$resourceId = $this->featureContext->spacesContext->getResourceId($user1, $spaceName, $file);
$response = GraphHelper::getActivities(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
Expand Down
45 changes: 45 additions & 0 deletions tests/acceptance/features/apiActivities/shareActivities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1076,3 +1076,48 @@ Feature: check share activity
}
}
"""

@issue-9849
Scenario: sharee tries to check activities of folder using share mountpoint id
Given user "Alice" has created folder "/FOLDER"
And user "Alice" has sent the following resource share invitation:
| resource | /FOLDER |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Editor |
And user "Brian" has a share "/FOLDER" synced
And user "Brian" has uploaded file with content "some data" to "Shares/FOLDER/newfile.txt"
And user "Brian" has uploaded file with content "edited data" to "Shares/FOLDER/newfile.txt"
And user "Brian" has deleted file "Shares/FOLDER/newfile.txt"
When user "Brian" lists the activities for folder "FOLDER" of space "Shares" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["value"],
"properties": {
"value": {
"type": "array",
"minItems": 0,
"maxItems": 0,
"uniqueItems": true,
"items": {
}
}
}
}
"""

@issue-9849
Scenario: sharee tries to check activities of another unshared file
Given user "Alice" has uploaded file with content "another ownCloud test text file" to "anotherTextfile.txt"
And user "Alice" has sent the following resource share invitation:
| resource | textfile.txt |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Brian" tries to list the activities of unshared file "anotherTextfile.txt" of user "Alice" from space "Personal" using the Graph API
Then the HTTP status code should be "403"

0 comments on commit dbea452

Please sign in to comment.