From d3bee8934152cf9ae7cd16afab7f5e80ed60320c Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 2 Jun 2023 14:33:01 +0545 Subject: [PATCH 1/3] Test comma-separated list of tags --- .../acceptance/features/apiSpaces/tag.feature | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/features/apiSpaces/tag.feature b/tests/acceptance/features/apiSpaces/tag.feature index 30df756437..84412c6b6c 100644 --- a/tests/acceptance/features/apiSpaces/tag.feature +++ b/tests/acceptance/features/apiSpaces/tag.feature @@ -1,7 +1,7 @@ @api @skipOnStable2.0 Feature: Tag - As a user - I want to tag resources + As a user + I want to tag resources So that I can sort and search them quickly Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production @@ -255,3 +255,32 @@ Feature: Tag And the response should contain following tags: | folderTag | | marketing | + + + Scenario: user creates a comma-separated list of tags for resources in the project space + Given user "Alice" has shared a space "use-tag" with settings: + | shareWith | Brian | + | role | viewer | + When user "Alice" creates the following tags for folder "folderMain" of space "use-tag": + | finance,नेपाल | + Then the HTTP status code should be "200" + When user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" using the WebDAV API + Then the HTTP status code should be "207" + And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs: + | key | value | + | oc:tags | finance,नेपाल | + When user "Alice" creates the following tags for file "folderMain/insideTheFolder.txt" of space "use-tag": + | file,नेपाल,Tag | + Then the HTTP status code should be "200" + When user "Brian" sends PROPFIND request from the space "use-tag" to the resource "folderMain/insideTheFolder.txt" using the WebDAV API + Then the HTTP status code should be "207" + And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs: + | key | value | + | oc:tags | file,नेपाल,Tag | + When user "Alice" lists all available tags via the GraphApi + Then the HTTP status code should be "200" + And the response should contain following tags: + | finance | + | नेपाल | + | file | + | Tag | From 0e2055bd4668d3d9eea97de3de4bf3b6cadbdc71 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 7 Jun 2023 16:56:54 +0545 Subject: [PATCH 2/3] Add test scenario that adds multiple tags --- .../acceptance/features/apiSpaces/tag.feature | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/acceptance/features/apiSpaces/tag.feature b/tests/acceptance/features/apiSpaces/tag.feature index 84412c6b6c..8526bb4f98 100644 --- a/tests/acceptance/features/apiSpaces/tag.feature +++ b/tests/acceptance/features/apiSpaces/tag.feature @@ -284,3 +284,23 @@ Feature: Tag | नेपाल | | file | | Tag | + + + Scenario: setting a comma-separated list of tags adds to any existing tags on the resource + Given user "Alice" has created the following tags for folder "folderMain" of the space "use-tag": + | finance,hr | + When user "Alice" creates the following tags for folder "folderMain" of space "use-tag": + | engineering,finance,qa | + Then the HTTP status code should be "200" + When user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" using the WebDAV API + Then the HTTP status code should be "207" + And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs: + | key | value | + | oc:tags | engineering,finance,hr,qa | + When user "Alice" lists all available tags via the GraphApi + Then the HTTP status code should be "200" + And the response should contain following tags: + | engineering | + | finance | + | hr | + | qa | From 3c998771296cae2e952eee6407d4f920a1d6b559 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 8 Jun 2023 11:21:28 +0545 Subject: [PATCH 3/3] adjust compare oc:tags lists --- tests/acceptance/features/bootstrap/SpacesContext.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 30bdfe0270..4918c9e46a 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -3153,6 +3153,15 @@ class SpacesContext implements Context { case "oc:privatelink": Assert::assertEquals($this->getPrivateLink($user, $spaceNameOrMountPoint), $responseValue, 'cannot find private link for space or resource in the response'); break; + case "oc:tags": + // The value should be a comma-separated string of tag names. + // We do not care what order they happen to be in, so compare as sorted lists. + $expectedTags = \explode(",", $value); + $expectedTags = \sort($expectedTags); + $actualTags = \explode(",", $responseValue); + $actualTags = \sort($actualTags); + Assert::assertEquals($expectedTags, $actualTags, "wrong $findItem in the response"); + break; default: Assert::assertEquals($value, $responseValue, "wrong $findItem in the response"); break;