diff --git a/tests/acceptance/features/apiTags/assignTags.feature b/tests/acceptance/features/apiTags/assignTags.feature index 0a532c513beb..b5c73a714040 100644 --- a/tests/acceptance/features/apiTags/assignTags.feature +++ b/tests/acceptance/features/apiTags/assignTags.feature @@ -1,5 +1,6 @@ @api @systemtags-app-required @files_sharing-app-required @issue-ocis-reva-51 Feature: Assign tags to file/folder + As a user I want to assign tags to the file/folder So that I can organize the files/folders easily @@ -25,8 +26,8 @@ Feature: Assign tags to file/folder Given the administrator has created a "normal" tag with name "MyFirstTag" And the administrator has created a "normal" tag with name "MySecondTag" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt" - When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API - And user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" owned by user "Alice" using the WebDAV API + And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt" + When user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" owned by user "Alice" using the WebDAV API Then the HTTP status code should be "404" And file "/myFileToTag.txt" owned by user "Alice" should have the following tags | name | type | @@ -38,8 +39,8 @@ Feature: Assign tags to file/folder And the administrator has created a "not user-assignable" tag with name "MySecondTag" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt" And user "Alice" has shared file "/myFileToTag.txt" with user "Brian" - When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API - And user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API + And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt" + When user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API Then the HTTP status code should be "403" And file "/myFileToTag.txt" shared by user "Alice" should have the following tags | name | type | @@ -77,8 +78,8 @@ Feature: Assign tags to file/folder And the administrator has created a "not user-visible" tag with name "MySecondTag" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt" And user "Alice" has shared file "/myFileToTag.txt" with user "Brian" - When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API - And user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API + And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt" + When user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API Then the HTTP status code should be "412" And file "/myFileToTag.txt" shared by user "Alice" should have the following tags | name | type | @@ -92,8 +93,8 @@ Feature: Assign tags to file/folder And the administrator has created a "static" tag with name "StaticTag" and groups "hash#group" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt" And user "Alice" has shared file "/myFileToTag.txt" with user "Brian" - When user "Alice" adds tag "NormalTag" to file "/myFileToTag.txt" using the WebDAV API - And user "Brian" adds tag "StaticTag" to file "/myFileToTag.txt" using the WebDAV API + And user "Alice" has added tag "NormalTag" to file "/myFileToTag.txt" + When user "Brian" adds tag "StaticTag" to file "/myFileToTag.txt" using the WebDAV API Then the HTTP status code should be "403" And file "/myFileToTag.txt" shared by user "Alice" should have the following tags | name | type | @@ -105,8 +106,8 @@ Feature: Assign tags to file/folder And the administrator has created a "not user-visible" tag with name "MySecondTag" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt" And user "Alice" has shared file "/myFileToTag.txt" with the administrator - When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API - And the administrator adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API + And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt" + When the administrator adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API Then the HTTP status code should be "201" And file "/myFileToTag.txt" should have the following tags for the administrator | name | type | @@ -122,8 +123,8 @@ Feature: Assign tags to file/folder And the administrator has created a "not user-assignable" tag with name "MySecondTag" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt" And user "Alice" has shared file "/myFileToTag.txt" with the administrator - When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API - And the administrator adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API + And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt" + When the administrator adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API Then the HTTP status code should be "201" And file "/myFileToTag.txt" should have the following tags for the administrator | name | type | diff --git a/tests/acceptance/features/apiTags/assignTagsGroup.feature b/tests/acceptance/features/apiTags/assignTagsGroup.feature index b1d1a4a072e1..826f889b33a0 100644 --- a/tests/acceptance/features/apiTags/assignTagsGroup.feature +++ b/tests/acceptance/features/apiTags/assignTagsGroup.feature @@ -1,6 +1,7 @@ @api @systemtags-app-required @issue-ocis-reva-51 -Feature: Title of your feature - I want to use this template for my feature file +Feature: Assign tag to groups + As a user + I should be able to assign tag to groups Background: Given user "Alice" has been created with default attributes and without skeleton files diff --git a/tests/acceptance/features/apiTags/createTags.feature b/tests/acceptance/features/apiTags/createTags.feature index aee07cc3404f..2dc7085813e8 100644 --- a/tests/acceptance/features/apiTags/createTags.feature +++ b/tests/acceptance/features/apiTags/createTags.feature @@ -117,23 +117,23 @@ Feature: Creation of tags Scenario: Creating tags in lowercase and uppercase should work - When the administrator creates a "normal" tag with name "UppercaseTag" using the WebDAV API - Then the HTTP status code should be "201" - When the administrator creates a "normal" tag with name "lowercasetag" using the WebDAV API - Then the HTTP status code should be "201" + When the administrator creates the following tags using the WebDAV API + | name | type | + | UppercaseTag | normal | + | lowercasetag | normal | + Then the HTTP status code of responses on all endpoints should be "201" And the following tags should exist for the administrator | name | type | | UppercaseTag | normal | | lowercasetag | normal | - Scenario: Creating tags with the same name in lowercase and uppercase should work - When the administrator creates a "normal" tag with name "testtag" using the WebDAV API - Then the HTTP status code should be "201" - When the administrator creates a "normal" tag with name "Testtag" using the WebDAV API - Then the HTTP status code should be "201" - When the administrator creates a "normal" tag with name "TESTTAG" using the WebDAV API - Then the HTTP status code should be "201" + When the administrator creates the following tags using the WebDAV API + | name | type | + | testtag | normal | + | Testtag | normal | + | TESTTAG | normal | + Then the HTTP status code of responses on all endpoints should be "201" And the following tags should exist for the administrator | name | type | | testtag | normal | diff --git a/tests/acceptance/features/apiTags/editTags.feature b/tests/acceptance/features/apiTags/editTags.feature index 2e933a55a7cb..0c10cdc8b7d4 100644 --- a/tests/acceptance/features/apiTags/editTags.feature +++ b/tests/acceptance/features/apiTags/editTags.feature @@ -10,7 +10,8 @@ Feature: Editing the tags Scenario Outline: Renaming a normal tag as regular user should work Given the administrator has created a "normal" tag with name "" When user "Alice" edits the tag with name "" and sets its name to "AnotherTagName" using the WebDAV API - Then the following tags should exist for the administrator + Then the HTTP status code should be "207" + And the following tags should exist for the administrator | name | type | | AnotherTagName | normal | Examples: @@ -23,7 +24,8 @@ Feature: Editing the tags Scenario: Renaming a not user-assignable tag as regular user should fail Given the administrator has created a "not user-assignable" tag with name "JustARegularTagName" When user "Alice" edits the tag with name "JustARegularTagName" and sets its name to "AnotherTagName" using the WebDAV API - Then the following tags should exist for the administrator + Then the HTTP status code should be "403" + And the following tags should exist for the administrator | name | type | | JustARegularTagName | not user-assignable | @@ -31,7 +33,8 @@ Feature: Editing the tags Scenario: Renaming a static tag as regular user should fail Given the administrator has created a "static" tag with name "StaticTagName" When user "Alice" edits the tag with name "StaticTagName" and sets its name to "AnotherTagName" using the WebDAV API - Then the following tags should exist for the administrator + Then the HTTP status code should be "403" + And the following tags should exist for the administrator | name | type | | StaticTagName | static | @@ -39,7 +42,8 @@ Feature: Editing the tags Scenario: Renaming a not user-visible tag as regular user should fail Given the administrator has created a "not user-visible" tag with name "JustARegularTagName" When user "Alice" edits the tag with name "JustARegularTagName" and sets its name to "AnotherTagName" using the WebDAV API - Then the following tags should exist for the administrator + Then the HTTP status code should be "404" + And the following tags should exist for the administrator | name | type | | JustARegularTagName | not user-visible | @@ -47,7 +51,8 @@ Feature: Editing the tags Scenario: Renaming a not user-assignable tag as administrator should work Given the administrator has created a "not user-assignable" tag with name "JustARegularTagName" When the administrator edits the tag with name "JustARegularTagName" and sets its name to "AnotherTagName" using the WebDAV API - Then the following tags should exist for the administrator + Then the HTTP status code should be "207" + And the following tags should exist for the administrator | name | type | | AnotherTagName | not user-assignable | And tag "JustARegularTagName" should not exist for the administrator @@ -56,7 +61,8 @@ Feature: Editing the tags Scenario: Renaming a not user-visible tag as administrator should work Given the administrator has created a "not user-visible" tag with name "JustARegularTagName" When the administrator edits the tag with name "JustARegularTagName" and sets its name to "AnotherTagName" using the WebDAV API - Then the following tags should exist for the administrator + Then the HTTP status code should be "207" + And the following tags should exist for the administrator | name | type | | AnotherTagName | not user-visible | And tag "JustARegularTagName" should not exist for the administrator @@ -65,7 +71,8 @@ Feature: Editing the tags Scenario: Renaming a static tag as administrator should work Given the administrator has created a "static" tag with name "StaticTagName" When the administrator edits the tag with name "StaticTagName" and sets its name to "AnotherTagName" using the WebDAV API - Then the following tags should exist for the administrator + Then the HTTP status code should be "207" + And the following tags should exist for the administrator | name | type | | AnotherTagName | static | And tag "StaticTagName" should not exist for the administrator @@ -74,16 +81,19 @@ Feature: Editing the tags Scenario: Editing tag groups as admin should work Given the administrator has created a "not user-assignable" tag with name "TagWithGroups" and groups "group1|group2" When the administrator edits the tag with name "TagWithGroups" and sets its groups to "group1|group3" using the WebDAV API - Then the "not user-assignable" tag with name "TagWithGroups" should have the groups "group1|group3" + Then the HTTP status code should be "207" + And the "not user-assignable" tag with name "TagWithGroups" should have the groups "group1|group3" @skipOnOcV10.6 @skipOnOcV10.7 Scenario: Editing static tag groups as admin should work Given the administrator has created a "static" tag with name "StaticTagWithGroups" and groups "group1|group2" When the administrator edits the tag with name "StaticTagWithGroups" and sets its groups to "group1|group3" using the WebDAV API - Then the "static" tag with name "StaticTagWithGroups" should have the groups "group1|group3" + Then the HTTP status code should be "207" + And the "static" tag with name "StaticTagWithGroups" should have the groups "group1|group3" @skipOnOcV10.6 @skipOnOcV10.7 Scenario: Editing tag groups as regular user should fail Given the administrator has created a "not user-assignable" tag with name "TagWithGroups" and groups "group1|group2" When user "Alice" edits the tag with name "TagWithGroups" and sets its groups to "group1|group3" using the WebDAV API - Then the "not user-assignable" tag with name "TagWithGroups" should have the groups "group1|group2" + Then the HTTP status code should be "403" + And the "not user-assignable" tag with name "TagWithGroups" should have the groups "group1|group2" diff --git a/tests/acceptance/features/apiTags/retreiveTags.feature b/tests/acceptance/features/apiTags/retreiveTags.feature index 6e2500a73051..857d0f82a624 100644 --- a/tests/acceptance/features/apiTags/retreiveTags.feature +++ b/tests/acceptance/features/apiTags/retreiveTags.feature @@ -11,15 +11,13 @@ Feature: tags Scenario: Getting tags only works with access to the file Given the administrator has created a "normal" tag with name "MyFirstTag" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt" - When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API - Then file "/myFileToTag.txt" should have the following tags for user "Alice" - | name | type | - | MyFirstTag | normal | - And the HTTP status when user "Brian" requests tags for file "/myFileToTag.txt" owned by user "Alice" should be "404" - When user "Alice" gets the following properties of file "/myFileToTag.txt" using the WebDAV API + And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt" + When user "Brian" requests tags for file "/myFileToTag.txt" owned by user "Alice" using the WebDAV API + And user "Alice" gets the following properties of file "/myFileToTag.txt" using the WebDAV API | propertyName | | oc:tags | - Then the single response should contain a property "oc:tags" with value "" + Then the HTTP status code of responses on all endpoints should be "404" + And the single response should contain a property "oc:tags" with value "" @files_sharing-app-required Scenario: Static tags should be available while accessing the file if it is assigned to file diff --git a/tests/acceptance/features/bootstrap/TagsContext.php b/tests/acceptance/features/bootstrap/TagsContext.php index 559c7a66b8e6..77a8243d1afb 100644 --- a/tests/acceptance/features/bootstrap/TagsContext.php +++ b/tests/acceptance/features/bootstrap/TagsContext.php @@ -187,6 +187,26 @@ public function theAdministratorCreatesATagWithName(string $type, string $name): ); } + /** + * @When the administrator creates the following tags using the WebDAV API + * + * @param TableNode $table + * + * @return void + * @throws Exception + */ + public function theAdministratorCreatesFollowingTags(TableNode $table):void { + $this->featureContext->emptyLastHTTPStatusCodesArray(); + $this->featureContext->verifyTableNodeColumns($table, ['name', 'type']); + foreach ($table->getHash() as $row) { + $this->createTagWithNameAsAdmin( + $row['type'], + $row['name'] + ); + $this->featureContext->pushToLastStatusCodesArrays(); + } + } + /** * @When /^the administrator creates a "([^"]*)" tag with name "([^"]*)" sending (true-false-strings|numbers) in the request using the WebDAV API$/ * @@ -1517,6 +1537,25 @@ public function theHttpStatusWhenUserRequestsTagsForEntryOwnedByShouldBe( ); } + /** + * @When /^user "([^"]*)" requests tags for (?:file|folder|entry) "([^"]*)" (?:shared|owned) by user "([^"]*)" using the WebDAV API$/ + * + * @param string $user + * @param string $fileName + * @param string $sharingUser + * + * @return void + * @throws Exception + */ + public function whenUserRequestsTagsForEntryOwnedByAnotherUser( + string $user, + string $fileName, + string $sharingUser + ):void { + $this->requestTagsForFile($user, $fileName, $sharingUser); + $this->featureContext->pushToLastStatusCodesArrays(); + } + /** * @Then /^(?:file|folder|entry) "([^"]*)" (?:shared|owned) by the (administrator|user) should have the following tags$/ * diff --git a/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php b/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php index 6aa79b570a18..17f4f7bd29eb 100644 --- a/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php +++ b/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php @@ -129,6 +129,7 @@ public function userGetsPropertiesOfFolder( $properties ) ); + $this->featureContext->pushToLastStatusCodesArrays(); } /**