Skip to content
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

[tests-only][full-ci] add test to check acivities by sharee #9842

Merged
merged 1 commit into from
Sep 26, 2024
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
52 changes: 50 additions & 2 deletions tests/acceptance/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2802,7 +2802,7 @@ public function getPermissionRoleDefinitionUsingGraphAPI(string $user, string $p
}

/**
* @When /^user "([^"]*)" lists the activities for (?:folder|file) "([^"]*)" of space "([^"]*)" using the Graph API/
* @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" using the Graph API/
*
* @param string $user
* @param string $resource
Expand All @@ -2823,6 +2823,54 @@ public function userListsTheActivitiesForResourceOfSpaceUsingTheGraphAPI(string
$this->featureContext->setResponse($response);
}

/**
* @When user :user tries to list the activities of folder :folder with share mount-point id using the Graph API
*
* @param string $user
* @param string $folder
*
* @return void
*/
public function userTriesToListTheActivitiesOfFolderWithShareMountIdPointIdUsingTheGraphApi(string $user, string $folder): void {
$resourceId = GraphHelper::getShareMountId(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$folder
);
$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 file :file from space :spaceName owned by user :owner using the Graph API
*
* @param string $user
* @param string $file
* @param string $owner
* @param string $spaceName
*
* @return void
*/
public function userTriesToListActivitiesOfFileFromSpaceOwnedByUserUsingTheGraphApi(string $user, string $file, string $owner, string $spaceName): void {
$resourceId = $this->featureContext->spacesContext->getResourceId($owner, $spaceName, $file);
$response = GraphHelper::getActivities(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$resourceId
);
$this->featureContext->setResponse($response);
}

/**
* @When user :user lists the activities of space :spaceName using the Graph API
*
Expand All @@ -2844,7 +2892,7 @@ public function userListsTheActivitiesOfSpaceUsingTheGraphApi(string $user, stri
}

/**
* @When /^user "([^"]*)" lists the activities for (?:folder|file) "([^"]*)" of space "([^"]*)" with (depth|limit) "([^"]*)" using the Graph API/
* @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit) "([^"]*)" using the Graph API/
*
* @param string $user
* @param string $resource
Expand Down
22 changes: 11 additions & 11 deletions tests/acceptance/features/apiActivities/activities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: check activities
Scenario: check activities after uploading a file and a folder
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile.txt"
And user "Alice" has created folder "/FOLDER"
When user "Alice" lists the activities for file "textfile.txt" of space "Personal" using the Graph API
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -100,7 +100,7 @@ Feature: check activities
}
}
"""
When user "Alice" lists the activities for folder "FOLDER" of space "Personal" using the Graph API
When user "Alice" lists the activities of folder "FOLDER" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -434,7 +434,7 @@ Feature: check activities
And user "Alice" has created folder "/New Folder"
And user "Alice" has moved file "textfile.txt" to "New Folder/textfile.txt"
And user "Alice" has moved folder "FOLDER" to "New Folder/FOLDER"
When user "Alice" lists the activities for file "New Folder/textfile.txt" of space "Personal" using the Graph API
When user "Alice" lists the activities of file "New Folder/textfile.txt" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -544,7 +544,7 @@ Feature: check activities
}
}
"""
When user "Alice" lists the activities for folder "New Folder/FOLDER" of space "Personal" using the Graph API
When user "Alice" lists the activities of folder "New Folder/FOLDER" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -661,7 +661,7 @@ Feature: check activities
And user "Alice" has created folder "/FOLDER"
And user "Alice" has moved file "textfile.txt" to "renamed.txt"
And user "Alice" has moved folder "/FOLDER" to "RENAMED FOLDER"
When user "Alice" lists the activities for file "renamed.txt" of space "Personal" using the Graph API
When user "Alice" lists the activities of file "renamed.txt" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -770,7 +770,7 @@ Feature: check activities
}
}
"""
When user "Alice" lists the activities for folder "RENAMED FOLDER" of space "Personal" using the Graph API
When user "Alice" lists the activities of folder "RENAMED FOLDER" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -892,7 +892,7 @@ Feature: check activities
And user "Alice" has moved folder "/New Folder/Sub Folder/Folder" to "/New Folder/Sub Folder/Renamed Folder"
And user "Alice" has deleted file "/New Folder/Sub Folder/renamed.txt"
And user "Alice" has deleted folder "/New Folder/Sub Folder/Renamed Folder"
When user "Alice" lists the activities for folder "/New Folder" of space "Personal" using the Graph API
When user "Alice" lists the activities of folder "/New Folder" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -1236,7 +1236,7 @@ Feature: check activities
Scenario: check activity message with different language
Given user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt"
And user "Alice" has switched the system language to "de" using the Graph API
When user "Alice" lists the activities for file "textfile.txt" of space "Personal" using the Graph API
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -1332,7 +1332,7 @@ Feature: check activities
Given user "Alice" has created folder "/New Folder"
And user "Alice" has created folder "/New Folder/Sub Folder"
And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/New Folder/Sub Folder/textfile.txt"
When user "Alice" lists the activities for folder "New Folder" of space "Personal" with depth "-1" using the Graph API
When user "Alice" lists the activities of folder "New Folder" from space "Personal" with depth "-1" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -1461,7 +1461,7 @@ Feature: check activities
Given user "Alice" has created folder "/New Folder"
And user "Alice" has created folder "/New Folder/Sub Folder"
And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/New Folder/Sub Folder/textfile.txt"
When user "Alice" lists the activities for folder "New Folder" of space "Personal" with depth "1" using the Graph API
When user "Alice" lists the activities of folder "New Folder" from space "Personal" with depth "1" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -1556,7 +1556,7 @@ Feature: check activities
Given user "Alice" has created folder "/New Folder"
And user "Alice" has created folder "/New Folder/Sub Folder"
And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/New Folder/Sub Folder/textfile.txt"
When user "Alice" lists the activities for folder "New Folder" of space "Personal" with limit "2" using the Graph API
When user "Alice" lists the activities of folder "New Folder" from space "Personal" with limit "2" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down
54 changes: 49 additions & 5 deletions tests/acceptance/features/apiActivities/shareActivities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: check share activity
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Alice" lists the activities for file "textfile.txt" of space "Personal" using the Graph API
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -138,7 +138,7 @@ Feature: check share activity
| shareType | user |
| permissionsRole | Viewer |
And user "Alice" has removed the access of user "Brian" from resource "textfile.txt" of space "Personal"
When user "Alice" lists the activities for file "textfile.txt" of space "Personal" using the Graph API
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -275,7 +275,7 @@ Feature: check share activity
| space | Personal |
| permissionsRole | view |
| password | %public% |
When user "Alice" lists the activities for file "textfile.txt" of space "Personal" using the Graph API
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -381,7 +381,7 @@ Feature: check share activity
| permissionsRole | view |
| password | %public% |
And user "Alice" has removed the last link share of file "textfile.txt" from space "Personal"
When user "Alice" lists the activities for file "textfile.txt" of space "Personal" using the Graph API
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -511,7 +511,7 @@ Feature: check share activity
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 "Alice" lists the activities for file "FOLDER" of space "Personal" using the Graph API
When user "Alice" lists the activities of file "FOLDER" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -1076,3 +1076,47 @@ Feature: check share activity
}
}
"""


Scenario: sharee tries to check the activities of a shared folder using share mount-point 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" tries to list the activities of folder "FOLDER" with share mount-point id using the Graph API
Then the HTTP status code should be "403"

@issue-9849
Scenario: sharee tries to check the activities of a shared folder using file-id
Given user "Alice" has created folder "/FOLDER"
And user "Alice" has uploaded file with content "some data" to "FOLDER/newfile.txt"
And user "ALice" has uploaded file with content "edited data" to "FOLDER/newfile.txt"
And user "ALice" has deleted file "FOLDER/newfile.txt"
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
When user "Brian" lists the activities of folder "FOLDER" from space "Shares" using the Graph API
prashant-gurung899 marked this conversation as resolved.
Show resolved Hide resolved
Then the HTTP status code should be "403"

@issue-9860
Scenario: sharee tries to check the activities of 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 file "anotherTextfile.txt" from space "Personal" owned by user "Alice" using the Graph API
Then the HTTP status code should be "403"