Merge pull request #10234 from owncloud/tests-limit-with-sort-activities

[tests-only][full-ci] add test to check api activities with limit and sort filter
This commit is contained in:
Sawjan Gurung
2024-10-08 16:33:44 +05:45
committed by GitHub
2 changed files with 54 additions and 2 deletions

View File

@@ -2805,7 +2805,7 @@ class GraphContext implements Context {
}
/**
* @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from 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
@@ -2936,7 +2936,7 @@ class GraphContext implements Context {
}
/**
* @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit|sort) "([^"]*)" using the Graph API/
* @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit|sort) "([^"]*)" using the Graph API$/
*
* @param string $user
* @param string $resource
@@ -2979,6 +2979,39 @@ class GraphContext implements Context {
}
}
/**
* @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit) "([^"]*)" and sort "(asc|desc)" using the Graph API$/
*
* @param string $user
* @param string $resource
* @param string $spaceName
* @param string $filterType
* @param string $filterValue
* @param string $sortType
*
* @return void
* @throws GuzzleException
*/
public function userListsTheActivitiesOfResourceFromSpaceWithDepthOrLimitAndSortUsingTheGraphApi(
string $user,
string $resource,
string $spaceName,
string $filterType,
string $filterValue,
string $sortType
): void {
$resourceId = $this->spacesContext->getResourceId($user, $spaceName, $resource);
$response = GraphHelper::getActivities(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$resourceId,
[$filterType => $filterValue, 'sort' => $sortType],
);
$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

View File

@@ -2154,6 +2154,25 @@ Feature: check activities
| textfile.txt | {user} added {resource} to {folder} |
| New Folder | {user} added {resource} to {folder} |
@issue-10150
Scenario: check activities with limit and sort filters (asc/desc)
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"
And user "Alice" has uploaded file with content "updated ownCloud test text file 0" to "/New Folder/Sub Folder/textfile.txt"
When user "Alice" lists the activities of folder "New Folder" from space "Personal" with limit "2" and sort "asc" using the Graph API
Then the HTTP status code should be "200"
And the activities should be in the following order:
| resource | message |
| New Folder | {user} added {resource} to {folder} |
| Sub Folder | {user} added {resource} to {folder} |
When user "Alice" lists the activities of folder "New Folder" from space "Personal" with limit "2" and sort "desc" using the Graph API
Then the HTTP status code should be "200"
And the activities should be in the following order:
| resource | message |
| textfile.txt | {user} updated {resource} in {folder} |
| textfile.txt | {user} added {resource} to {folder} |
@issue-9860
Scenario: user tries to check activities of another user's file
Given user "Brian" has been created with default attributes and without skeleton files