Merge pull request #9861 from owncloud/test-activities-depth-filter
[tests-only] [full-ci] Test for activity filters
This commit is contained in:
@@ -2326,6 +2326,7 @@ class GraphHelper {
|
|||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @param string $resourceId
|
* @param string $resourceId
|
||||||
|
* @param array $filterParams
|
||||||
*
|
*
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*/
|
*/
|
||||||
@@ -2334,11 +2335,17 @@ class GraphHelper {
|
|||||||
string $requestId,
|
string $requestId,
|
||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
string $resourceId
|
string $resourceId,
|
||||||
|
?array $filterParams = []
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
// 'kql=itemId' filter is required for the current implementation but it might change in future
|
// 'kql=itemId' filter is required for the current implementation but it might change in future
|
||||||
// See: https://github.com/owncloud/ocis/issues/9194
|
// See: https://github.com/owncloud/ocis/issues/9194
|
||||||
$fullUrl = self::getBetaFullUrl($baseUrl, "extensions/org.libregraph/activities?kql=itemid%3A$resourceId");
|
$fullUrl = self::getBetaFullUrl($baseUrl, "extensions/org.libregraph/activities?kql=itemid%3A$resourceId");
|
||||||
|
if (!empty($filterParams)) {
|
||||||
|
foreach ($filterParams as $filter => $value) {
|
||||||
|
$fullUrl .= "+AND+$filter%3A$value";
|
||||||
|
}
|
||||||
|
}
|
||||||
return HttpRequestHelper::get(
|
return HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$requestId,
|
$requestId,
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ Feature: check activities
|
|||||||
|
|
||||||
@issue-9712
|
@issue-9712
|
||||||
Scenario: check activities after uploading a file and a folder
|
Scenario: check activities after uploading a file and a folder
|
||||||
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt"
|
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile.txt"
|
||||||
And user "Alice" has created folder "/FOLDER"
|
And user "Alice" has created folder "/FOLDER"
|
||||||
When user "Alice" lists the activities for file "textfile0.txt" of space "Personal" using the Graph API
|
When user "Alice" lists the activities for file "textfile.txt" of space "Personal" using the Graph API
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
And the JSON data of the response should match
|
And the JSON data of the response should match
|
||||||
"""
|
"""
|
||||||
@@ -50,7 +50,7 @@ Feature: check activities
|
|||||||
"pattern": "%file_id_pattern%"
|
"pattern": "%file_id_pattern%"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"const": "textfile0.txt"
|
"const": "textfile.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -193,9 +193,9 @@ Feature: check activities
|
|||||||
|
|
||||||
@issue-9712
|
@issue-9712
|
||||||
Scenario: check activities after deleting a file and a folder
|
Scenario: check activities after deleting a file and a folder
|
||||||
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt"
|
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile.txt"
|
||||||
And user "Alice" has created folder "/FOLDER"
|
And user "Alice" has created folder "/FOLDER"
|
||||||
And user "Alice" has deleted file "textfile0.txt"
|
And user "Alice" has deleted file "textfile.txt"
|
||||||
And user "Alice" has deleted folder "FOLDER"
|
And user "Alice" has deleted folder "FOLDER"
|
||||||
When user "Alice" lists the activities of space "Personal" using the Graph API
|
When user "Alice" lists the activities of space "Personal" using the Graph API
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
@@ -232,7 +232,7 @@ Feature: check activities
|
|||||||
"required": ["id", "name"],
|
"required": ["id", "name"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"const": "textfile0.txt"
|
"const": "textfile.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ Feature: check activities
|
|||||||
"pattern": "%file_id_pattern%"
|
"pattern": "%file_id_pattern%"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"const": "textfile0.txt"
|
"const": "textfile.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -429,12 +429,12 @@ Feature: check activities
|
|||||||
|
|
||||||
@issue-9712
|
@issue-9712
|
||||||
Scenario: check move activity for a file and a folder
|
Scenario: check move activity for a file and a folder
|
||||||
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt"
|
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile.txt"
|
||||||
And user "Alice" has created folder "/FOLDER"
|
And user "Alice" has created folder "/FOLDER"
|
||||||
And user "Alice" has created folder "/New Folder"
|
And user "Alice" has created folder "/New Folder"
|
||||||
And user "Alice" has moved file "textfile0.txt" to "New Folder/textfile0.txt"
|
And user "Alice" has moved file "textfile.txt" to "New Folder/textfile.txt"
|
||||||
And user "Alice" has moved folder "FOLDER" to "New Folder/FOLDER"
|
And user "Alice" has moved folder "FOLDER" to "New Folder/FOLDER"
|
||||||
When user "Alice" lists the activities for file "New Folder/textfile0.txt" of space "Personal" using the Graph API
|
When user "Alice" lists the activities for file "New Folder/textfile.txt" of space "Personal" using the Graph API
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
And the JSON data of the response should match
|
And the JSON data of the response should match
|
||||||
"""
|
"""
|
||||||
@@ -492,7 +492,7 @@ Feature: check activities
|
|||||||
"pattern": "^%file_id_pattern%$"
|
"pattern": "^%file_id_pattern%$"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"const": "textfile0.txt"
|
"const": "textfile.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -657,9 +657,9 @@ Feature: check activities
|
|||||||
|
|
||||||
@issue-9712
|
@issue-9712
|
||||||
Scenario: check rename activity for a file and a folder
|
Scenario: check rename activity for a file and a folder
|
||||||
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt"
|
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile.txt"
|
||||||
And user "Alice" has created folder "/FOLDER"
|
And user "Alice" has created folder "/FOLDER"
|
||||||
And user "Alice" has moved file "textfile0.txt" to "renamed.txt"
|
And user "Alice" has moved file "textfile.txt" to "renamed.txt"
|
||||||
And user "Alice" has moved folder "/FOLDER" to "RENAMED FOLDER"
|
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 for file "renamed.txt" of space "Personal" using the Graph API
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
@@ -718,7 +718,7 @@ Feature: check activities
|
|||||||
"const": ""
|
"const": ""
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"const": "textfile0.txt"
|
"const": "textfile.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -885,10 +885,10 @@ Feature: check activities
|
|||||||
Given user "Alice" has created folder "/New Folder"
|
Given user "Alice" has created folder "/New Folder"
|
||||||
And user "Alice" has created folder "/New Folder/Folder"
|
And user "Alice" has created folder "/New Folder/Folder"
|
||||||
And user "Alice" has created folder "/New Folder/Sub 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/textfile0.txt"
|
And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/New Folder/textfile.txt"
|
||||||
And user "Alice" has moved file "/New Folder/textfile0.txt" to "/New Folder/Sub Folder/textfile0.txt"
|
And user "Alice" has moved file "/New Folder/textfile.txt" to "/New Folder/Sub Folder/textfile.txt"
|
||||||
And user "Alice" has moved folder "/New Folder/Folder" to "/New Folder/Sub Folder/Folder"
|
And user "Alice" has moved folder "/New Folder/Folder" to "/New Folder/Sub Folder/Folder"
|
||||||
And user "Alice" has moved file "/New Folder/Sub Folder/textfile0.txt" to "/New Folder/Sub Folder/renamed.txt"
|
And user "Alice" has moved file "/New Folder/Sub Folder/textfile.txt" to "/New Folder/Sub Folder/renamed.txt"
|
||||||
And user "Alice" has moved folder "/New Folder/Sub Folder/Folder" to "/New Folder/Sub Folder/Renamed Folder"
|
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 file "/New Folder/Sub Folder/renamed.txt"
|
||||||
And user "Alice" has deleted folder "/New Folder/Sub Folder/Renamed Folder"
|
And user "Alice" has deleted folder "/New Folder/Sub Folder/Renamed Folder"
|
||||||
@@ -1017,7 +1017,7 @@ Feature: check activities
|
|||||||
"required": ["id", "name"],
|
"required": ["id", "name"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"const": "textfile0.txt"
|
"const": "textfile.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1047,7 +1047,7 @@ Feature: check activities
|
|||||||
"required": ["id", "name"],
|
"required": ["id", "name"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"const": "textfile0.txt"
|
"const": "textfile.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1107,7 +1107,7 @@ Feature: check activities
|
|||||||
"required": ["id", "name"],
|
"required": ["id", "name"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"const": "textfile0.txt"
|
"const": "textfile.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1326,3 +1326,193 @@ Feature: check activities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@issue-9850
|
||||||
|
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/textfile.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"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
@issue-9880
|
||||||
|
Scenario: check activity with limit 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/textfile.txt"
|
||||||
|
When user "Alice" lists the activities for folder "New Folder" of 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
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"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"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|||||||
@@ -2839,6 +2839,30 @@ class GraphContext implements Context {
|
|||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When /^user "([^"]*)" lists the activities for (?:folder|file) "([^"]*)" of space "([^"]*)" with (depth|limit) "([^"]*)" using the Graph API/
|
||||||
|
*
|
||||||
|
* @param string $user
|
||||||
|
* @param string $resource
|
||||||
|
* @param string $spaceName
|
||||||
|
* @param string $filterType
|
||||||
|
* @param string $filterValue
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function userListsTheActivitiesForFolderOfSpaceWithDepthOrLimitUsingTheGraphApi(string $user, string $resource, string $spaceName, string $filterType, string $filterValue): void {
|
||||||
|
$resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource);
|
||||||
|
$response = GraphHelper::getActivities(
|
||||||
|
$this->featureContext->getBaseUrl(),
|
||||||
|
$this->featureContext->getStepLineRef(),
|
||||||
|
$user,
|
||||||
|
$this->featureContext->getPasswordForUser($user),
|
||||||
|
$resourceId,
|
||||||
|
[$filterType => $filterValue]
|
||||||
|
);
|
||||||
|
$this->featureContext->setResponse($response);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @When the administrator gets federated users using the Graph API
|
* @When the administrator gets federated users using the Graph API
|
||||||
* @When user :user tries to get federated users using the Graph API
|
* @When user :user tries to get federated users using the Graph API
|
||||||
@@ -2849,7 +2873,7 @@ class GraphContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theUserGetsFederatedUsersUsingTheGraphApi(?string $user = null): void {
|
public function theUserGetsFederatedUsersUsingTheGraphApi(?string $user = null): void {
|
||||||
$credentials = $this->getAdminOrUserCredentials($user);
|
$credentials = $this->getAdminOrUserCredentials($user);
|
||||||
|
|
||||||
$response = GraphHelper::getFederatedUsers(
|
$response = GraphHelper::getFederatedUsers(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$this->featureContext->getStepLineRef(),
|
$this->featureContext->getStepLineRef(),
|
||||||
@@ -2870,7 +2894,7 @@ class GraphContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theUserGetsAllUsersUsingTheGraphApi(?string $user = null): void {
|
public function theUserGetsAllUsersUsingTheGraphApi(?string $user = null): void {
|
||||||
$credentials = $this->getAdminOrUserCredentials($user);
|
$credentials = $this->getAdminOrUserCredentials($user);
|
||||||
|
|
||||||
$response = GraphHelper::getAllUsers(
|
$response = GraphHelper::getAllUsers(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$this->featureContext->getStepLineRef(),
|
$this->featureContext->getStepLineRef(),
|
||||||
|
|||||||
Reference in New Issue
Block a user