mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-27 08:20:26 -06:00
add test for activity depth filter
This commit is contained in:
@@ -2326,6 +2326,7 @@ class GraphHelper {
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $resourceId
|
||||
* @param string $depth
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
@@ -2334,11 +2335,16 @@ class GraphHelper {
|
||||
string $requestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $resourceId
|
||||
string $resourceId,
|
||||
?string $depth = null
|
||||
): ResponseInterface {
|
||||
// 'kql=itemId' filter is required for the current implementation but it might change in future
|
||||
// See: https://github.com/owncloud/ocis/issues/9194
|
||||
$fullUrl = self::getBetaFullUrl($baseUrl, "extensions/org.libregraph/activities?kql=itemid%3A$resourceId");
|
||||
if ($depth !== null) {
|
||||
$fullUrl = self::getBetaFullUrl($baseUrl, "extensions/org.libregraph/activities?kql=itemid%3A$resourceId+AND+depth%3A$depth");
|
||||
} else {
|
||||
$fullUrl = self::getBetaFullUrl($baseUrl, "extensions/org.libregraph/activities?kql=itemid%3A$resourceId");
|
||||
}
|
||||
return HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$requestId,
|
||||
|
||||
@@ -1326,3 +1326,98 @@ Feature: check activities
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@issue-9712
|
||||
Scenario: check activity with depth filter
|
||||
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/textfile0.txt"
|
||||
When user "Alice" lists the activities for folder "New Folder" of 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
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["value"],
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "array",
|
||||
"minItems": 2,
|
||||
"maxItems": 2,
|
||||
"uniqueItems": true,
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["id", "template", "times"],
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "object",
|
||||
"required": ["message", "variables"],
|
||||
"properties": {
|
||||
"message": {
|
||||
"const": "{user} added {resource} to {space}"
|
||||
},
|
||||
"variables": {
|
||||
"type": "object",
|
||||
"required": ["resource", "space", "user"],
|
||||
"properties": {
|
||||
"resource": {
|
||||
"type": "object",
|
||||
"required": ["id", "name"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"const": "New Folder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"times": {
|
||||
"type": "object",
|
||||
"required": ["recordedTime"]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["id", "template", "times"],
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "object",
|
||||
"required": ["message", "variables"],
|
||||
"properties": {
|
||||
"message": {
|
||||
"const": "{user} added {resource} to {space}"
|
||||
},
|
||||
"variables": {
|
||||
"type": "object",
|
||||
"required": ["resource", "space", "user"],
|
||||
"properties": {
|
||||
"resource": {
|
||||
"type": "object",
|
||||
"required": ["id", "name"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"const": "Sub Folder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"times": {
|
||||
"type": "object",
|
||||
"required": ["recordedTime"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
187
tests/acceptance/features/apiActivities/activityFilter.feature
Normal file
187
tests/acceptance/features/apiActivities/activityFilter.feature
Normal file
@@ -0,0 +1,187 @@
|
||||
@issue-9712
|
||||
Feature: activity filter
|
||||
As a user
|
||||
I want to filter activities
|
||||
So that I can track modifications of specific resource
|
||||
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
|
||||
|
||||
Scenario: check activity with depth filter
|
||||
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/textfile0.txt"
|
||||
When user "Alice" lists the activities for folder "New Folder" of space "Personal" with depth "0" 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": 1,
|
||||
"maxItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["id", "template", "times"],
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "object",
|
||||
"required": ["message", "variables"],
|
||||
"properties": {
|
||||
"message": {
|
||||
"const": "{user} added {resource} to {space}"
|
||||
},
|
||||
"variables": {
|
||||
"type": "object",
|
||||
"required": ["resource", "space", "user"],
|
||||
"properties": {
|
||||
"resource": {
|
||||
"type": "object",
|
||||
"required": ["id", "name"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"const": "New Folder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"times": {
|
||||
"type": "object",
|
||||
"required": ["recordedTime"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
When user "Alice" lists the activities for folder "New Folder" of space "Personal" with depth "2" 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": 3,
|
||||
"maxItems": 3,
|
||||
"uniqueItems": true,
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["id", "template", "times"],
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "object",
|
||||
"required": ["message", "variables"],
|
||||
"properties": {
|
||||
"message": {
|
||||
"const": "{user} added {resource} to {space}"
|
||||
},
|
||||
"variables": {
|
||||
"type": "object",
|
||||
"required": ["resource", "space", "user"],
|
||||
"properties": {
|
||||
"resource": {
|
||||
"type": "object",
|
||||
"required": ["id", "name"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"const": "New Folder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"times": {
|
||||
"type": "object",
|
||||
"required": ["recordedTime"]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["id", "template", "times"],
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "object",
|
||||
"required": ["message", "variables"],
|
||||
"properties": {
|
||||
"message": {
|
||||
"const": "{user} added {resource} to {space}"
|
||||
},
|
||||
"variables": {
|
||||
"type": "object",
|
||||
"required": ["resource", "space", "user"],
|
||||
"properties": {
|
||||
"resource": {
|
||||
"type": "object",
|
||||
"required": ["id", "name"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"const": "Sub Folder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"times": {
|
||||
"type": "object",
|
||||
"required": ["recordedTime"]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["id", "template", "times"],
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "object",
|
||||
"required": ["message", "variables"],
|
||||
"properties": {
|
||||
"message": {
|
||||
"const": "{user} added {resource} to {space}"
|
||||
},
|
||||
"variables": {
|
||||
"type": "object",
|
||||
"required": ["resource", "space", "user"],
|
||||
"properties": {
|
||||
"resource": {
|
||||
"type": "object",
|
||||
"required": ["id", "name"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"const": "textfile0.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"times": {
|
||||
"type": "object",
|
||||
"required": ["recordedTime"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -2839,6 +2839,29 @@ class GraphContext implements Context {
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" lists the activities for (?:folder|file) "([^"]*)" of space "([^"]*)" with depth "([^"]*)" using the Graph API/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
* @param string $spaceName
|
||||
* @param string $folderDepth
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userListsTheActivitiesForFolderOfSpaceWithDepthUsingTheGraphApi(string $user, string $resource, string $spaceName, string $folderDepth): void {
|
||||
$resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource);
|
||||
$response = GraphHelper::getActivities(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$resourceId,
|
||||
$folderDepth
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator gets federated users using the Graph API
|
||||
* @When user :user tries to get federated users using the Graph API
|
||||
|
||||
Reference in New Issue
Block a user