Merge pull request #11317 from owncloud/add-tests-for-exceeding-tags-amount-during-creation
[tests-only][full-ci]Add tests for exceeding tags amount
This commit is contained in:
4 files changed
+60
-13
No files matched your search
@@ -56,25 +56,21 @@ class TagContext implements Context {
|
||||
|
||||
/**
|
||||
* @param string $user
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
* @param string $resource
|
||||
* @param string $space
|
||||
* @param TableNode $table
|
||||
* @param array $tagNameArray
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function createTags(
|
||||
string $user,
|
||||
string $fileOrFolder,
|
||||
string $resource,
|
||||
string $space,
|
||||
TableNode $table
|
||||
array $tagNameArray
|
||||
): ResponseInterface {
|
||||
$tagNameArray = [];
|
||||
foreach ($table->getRows() as $value) {
|
||||
$tagNameArray[] = $value[0];
|
||||
}
|
||||
if ($fileOrFolder === 'folder' || $fileOrFolder === 'folders') {
|
||||
$resourceId = $this->spacesContext->getResourceId($user, $space, $resource);
|
||||
} else {
|
||||
@@ -109,7 +105,11 @@ class TagContext implements Context {
|
||||
string $space,
|
||||
TableNode $table
|
||||
): void {
|
||||
$response = $this->createTags($user, $fileOrFolder, $resource, $space, $table);
|
||||
$tagNameArray = [];
|
||||
foreach ($table->getRows() as $value) {
|
||||
$tagNameArray[] = $value[0];
|
||||
}
|
||||
$response = $this->createTags($user, $fileOrFolder, $resource, $space, $tagNameArray);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,11 @@ class TagContext implements Context {
|
||||
string $space,
|
||||
TableNode $table
|
||||
): void {
|
||||
$response = $this->createTags($user, $fileOrFolder, $resource, $space, $table);
|
||||
$tagNameArray = [];
|
||||
foreach ($table->getRows() as $value) {
|
||||
$tagNameArray[] = $value[0];
|
||||
}
|
||||
$response = $this->createTags($user, $fileOrFolder, $resource, $space, $tagNameArray);
|
||||
$this->featureContext->theHttpStatusCodeShouldBe(200, "", $response);
|
||||
}
|
||||
|
||||
@@ -156,8 +160,8 @@ class TagContext implements Context {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ["path", "tagName"]);
|
||||
$rows = $table->getHash();
|
||||
foreach ($rows as $row) {
|
||||
$tags = explode(',', $row['tagName']);
|
||||
$response = $this->createTags($user, $filesOrFolders, $row['path'], $space, new TableNode([$tags]));
|
||||
$tagNameArray = array_map('trim', explode(',', $row['tagName']));
|
||||
$response = $this->createTags($user, $filesOrFolders, $row['path'], $space, $tagNameArray);
|
||||
$this->featureContext->theHttpStatusCodeShouldBe(200, "", $response);
|
||||
}
|
||||
}
|
||||
@@ -302,4 +306,31 @@ class TagContext implements Context {
|
||||
$response = $this->removeTagsFromResourceOfTheSpace($user, $fileOrFolder, $resource, $space, $table);
|
||||
$this->featureContext->theHttpStatusCodeShouldBe(200, "", $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" creates "([^"]*)" tags for (folder|file) "([^"]*)" of space "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param int $numberOfTags
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
* @param string $resource
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userCreatesTagsForResourceOfSpace(
|
||||
string $user,
|
||||
int $numberOfTags,
|
||||
string $fileOrFolder,
|
||||
string $resource,
|
||||
string $space
|
||||
): void {
|
||||
$tagNames = [];
|
||||
foreach (range(1, $numberOfTags) as $tagNumber) {
|
||||
$tagNames[] = "testTag$tagNumber";
|
||||
}
|
||||
$response = $this->createTags($user, $fileOrFolder, $resource, $space, $tagNames);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ default:
|
||||
- OcisConfigContext:
|
||||
- WebDavLockingContext:
|
||||
- SharingNgContext:
|
||||
- SearchContext:
|
||||
|
||||
apiSpacesShares:
|
||||
paths:
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
- [apiSearchContent/contentSearch.feature:238](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSearchContent/contentSearch.feature#L238)
|
||||
- [apiSearchContent/contentSearch.feature:239](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSearchContent/contentSearch.feature#L239)
|
||||
- [apiSearchContent/contentSearch.feature:268](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSearchContent/contentSearch.feature#L268)
|
||||
- [apiSpaces/tag.feature:369](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/tag.feature#L369)
|
||||
- [cliCommands/searchReIndex.feature:15](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/cliCommands/searchReIndex.feature#L15)
|
||||
- [coreApiWebdavOperations/search.feature:44](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/search.feature#L44)
|
||||
- [coreApiWebdavOperations/search.feature:62](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/search.feature#L62)
|
||||
|
||||
@@ -363,4 +363,18 @@ Feature: Tag
|
||||
When user "Alice" creates the following tags for folder "folderMain" of space "Alice Hansen":
|
||||
| my tag |
|
||||
| Loremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliqua,qa |
|
||||
Then the HTTP status code should be "200"
|
||||
Then the HTTP status code should be "200"
|
||||
|
||||
|
||||
Scenario: user tries to create tags above 100, only first 100 tags will be created
|
||||
Given the config "OCIS_MAX_TAG_LENGTH" has been set to "100"
|
||||
And user "Alice" has created a folder "folderMain" in space "Alice Hansen"
|
||||
When user "Alice" creates "200" tags for folder "folderMain" of space "Alice Hansen"
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Alice" searches for "Tags:testTag100" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the search result of user "Alice" should contain only these files:
|
||||
| folderMain |
|
||||
When user "Alice" searches for "Tags:testTag101" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the search result should contain "0" entries
|
||||
Reference in new issue
Block a user