From 5d25563634172dcbd511cf115490159443c07dfe Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 12 Sep 2016 16:20:49 +0200 Subject: New dav endpoint register tags plugin This makes it possible to retrieve and PROPPATCH the favorite info Signed-off-by: Lukas Reschke --- apps/dav/lib/Server.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index c49df197a89..a06d4c570f6 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -47,6 +47,7 @@ use OCP\IRequest; use OCP\SabrePluginEvent; use Sabre\CardDAV\VCFExportPlugin; use Sabre\DAV\Auth\Plugin; +use OCA\DAV\Connector\Sabre\TagsPlugin; class Server { @@ -190,6 +191,11 @@ class Server { $this->server->addPlugin( new QuotaPlugin($view) ); + $this->server->addPlugin( + new TagsPlugin( + $this->server->tree, \OC::$server->getTagManager() + ) + ); } }); } -- cgit v1.2.3 From 88b0af4211f72d2607d4aa2eef0be681340352f1 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Tue, 13 Sep 2016 11:38:36 -0400 Subject: Added failing tests Signed-off-by: Lukas Reschke --- build/integration/features/favorites.feature | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/build/integration/features/favorites.feature b/build/integration/features/favorites.feature index 86643fdd1e2..605e9fd6d7b 100644 --- a/build/integration/features/favorites.feature +++ b/build/integration/features/favorites.feature @@ -40,3 +40,41 @@ Feature: favorite |{http://owncloud.org/ns}favorite| And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "" + Scenario: Favorite a folder new endpoint + Given using dav path "remote.php/dav" + And As an "admin" + And user "user0" exists + When user "user0" favorites element "/FOLDER" + Then as "user0" gets properties of folder "/FOLDER" with + |{http://owncloud.org/ns}favorite| + And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1" + + Scenario: Favorite and unfavorite a folder + Given using dav path "remote.php/dav" + And As an "admin" + And user "user0" exists + When user "user0" favorites element "/FOLDER" + And user "user0" unfavorites element "/FOLDER" + Then as "user0" gets properties of folder "/FOLDER" with + |{http://owncloud.org/ns}favorite| + And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "" + + Scenario: Favorite a file + Given using dav path "remote.php/dav" + And As an "admin" + And user "user0" exists + When user "user0" favorites element "/textfile0.txt" + Then as "user0" gets properties of file "/textfile0.txt" with + |{http://owncloud.org/ns}favorite| + And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1" + + Scenario: Favorite and unfavorite a file + Given using dav path "remote.php/dav" + And As an "admin" + And user "user0" exists + When user "user0" favorites element "/textfile0.txt" + And user "user0" unfavorites element "/textfile0.txt" + Then as "user0" gets properties of file "/textfile0.txt" with + |{http://owncloud.org/ns}favorite| + And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "" + -- cgit v1.2.3 From d81f4ea53ced0921072d7688146b8dae028268cf Mon Sep 17 00:00:00 2001 From: Sergio BertolĂ­n Date: Tue, 20 Sep 2016 15:16:39 +0000 Subject: Modifications to avoid old dav path Signed-off-by: Lukas Reschke --- build/integration/features/bootstrap/WebDav.php | 4 ++-- build/integration/features/favorites.feature | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index be181f2bcb7..c25add74f38 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -368,7 +368,7 @@ trait WebDav { } public function makeSabrePath($path) { - return $this->encodePath($this->davPath . '/' . ltrim($path, '/')); + return $this->encodePath($this->davPath . $this->getFilesPath() . ltrim($path, '/')); } public function getSabreClient($user) { @@ -584,7 +584,7 @@ trait WebDav { ]; } - $response = $client->proppatch($this->davPath . '/' . ltrim($path, '/'), $properties, $folderDepth); + $response = $client->proppatch($this->davPath . $this->getFilesPath() . ltrim($path, '/'), $properties, $folderDepth); return $response; } diff --git a/build/integration/features/favorites.feature b/build/integration/features/favorites.feature index 605e9fd6d7b..baf4eadb166 100644 --- a/build/integration/features/favorites.feature +++ b/build/integration/features/favorites.feature @@ -49,7 +49,7 @@ Feature: favorite |{http://owncloud.org/ns}favorite| And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1" - Scenario: Favorite and unfavorite a folder + Scenario: Favorite and unfavorite a folder new endpoint Given using dav path "remote.php/dav" And As an "admin" And user "user0" exists @@ -59,7 +59,7 @@ Feature: favorite |{http://owncloud.org/ns}favorite| And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "" - Scenario: Favorite a file + Scenario: Favorite a file new endpoint Given using dav path "remote.php/dav" And As an "admin" And user "user0" exists @@ -68,7 +68,7 @@ Feature: favorite |{http://owncloud.org/ns}favorite| And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1" - Scenario: Favorite and unfavorite a file + Scenario: Favorite and unfavorite a file new endpoint Given using dav path "remote.php/dav" And As an "admin" And user "user0" exists -- cgit v1.2.3 From 09a90b40002d1ee798b7012639c1c2ece81ebe7c Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Wed, 21 Sep 2016 08:18:10 +0000 Subject: User was incorrect Signed-off-by: Lukas Reschke --- build/integration/features/bootstrap/WebDav.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index c25add74f38..ad29f28e105 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -53,9 +53,9 @@ trait WebDav { /** * @return string */ - public function getFilesPath() { - if ($this->davPath === 'remote.php/dav') { - $basePath = '/files/' . $this->currentUser . '/'; + public function getFilesPath($user) { + if ($this->davPath === "remote.php/dav") { + $basePath = '/files/' . $user . '/'; } else { $basePath = '/'; } @@ -262,12 +262,13 @@ trait WebDav { /** * @Then /^as "([^"]*)" the (file|folder|entry) "([^"]*)" does not exist$/ * @param string $user + * @param string $entry * @param string $path * @param \Behat\Gherkin\Node\TableNode|null $propertiesTable */ public function asTheFileOrFolderDoesNotExist($user, $entry, $path) { $client = $this->getSabreClient($user); - $response = $client->request('HEAD', $this->makeSabrePath($path)); + $response = $client->request('HEAD', $this->makeSabrePath($user, $path)); if ($response['statusCode'] !== 404) { throw new \Exception($entry . ' "' . $path . '" expected to not exist (status code ' . $response['statusCode'] . ', expected 404)'); } @@ -278,8 +279,8 @@ trait WebDav { /** * @Then /^as "([^"]*)" the (file|folder|entry) "([^"]*)" exists$/ * @param string $user + * @param string $entry * @param string $path - * @param \Behat\Gherkin\Node\TableNode|null $propertiesTable */ public function asTheFileOrFolderExists($user, $entry, $path) { $this->response = $this->listFolder($user, $path, 0); @@ -362,13 +363,13 @@ trait WebDav { ]; } - $response = $client->propfind($this->makeSabrePath($path), $properties, $folderDepth); + $response = $client->propfind($this->makeSabrePath($user, $path), $properties, $folderDepth); return $response; } - public function makeSabrePath($path) { - return $this->encodePath($this->davPath . $this->getFilesPath() . ltrim($path, '/')); + public function makeSabrePath($user, $path) { + return $this->encodePath($this->davPath . $this->getFilesPath($user) . ltrim($path, '/')); } public function getSabreClient($user) { @@ -474,7 +475,7 @@ trait WebDav { */ public function userCreatedAFolder($user, $destination) { try { - $this->response = $this->makeDavRequest($user, "MKCOL", $this->getFilesPath() . ltrim($destination, $this->getFilesPath()), []); + $this->response = $this->makeDavRequest($user, "MKCOL", $this->getFilesPath($user) . ltrim($destination, $this->getFilesPath($user)), []); } catch (\GuzzleHttp\Exception\ServerException $e) { // 4xx and 5xx responses cause an exception $this->response = $e->getResponse(); @@ -584,7 +585,7 @@ trait WebDav { ]; } - $response = $client->proppatch($this->davPath . $this->getFilesPath() . ltrim($path, '/'), $properties, $folderDepth); + $response = $client->proppatch($this->davPath . $this->getFilesPath($user) . ltrim($path, '/'), $properties, $folderDepth); return $response; } -- cgit v1.2.3