From ca18407aa437cf9157ad99dd30443d7b171f867e Mon Sep 17 00:00:00 2001 From: Dipak Acharya Date: Wed, 14 Jul 2021 15:13:59 +0545 Subject: [PATCH] [Tests-Only] Add api tests for listing files with propfind --- tests/TestHelpers/WebDavHelper.php | 7 + tests/acceptance/config/behat.yml | 1 + ...eateShareResourceCaseSensitiveName.feature | 2 +- ...eateShareResourceCaseSensitiveName.feature | 4 +- .../apiWebdavOperations/listFiles.feature | 224 ++++++++++++++++++ .../features/bootstrap/FeatureContext.php | 12 + .../features/bootstrap/TrashbinContext.php | 106 ++++++++- .../acceptance/features/bootstrap/WebDav.php | 141 ++++++++++- .../features/webUIAddUsers/addUsers.feature | 2 +- 9 files changed, 490 insertions(+), 9 deletions(-) create mode 100644 tests/acceptance/features/apiWebdavOperations/listFiles.feature diff --git a/tests/TestHelpers/WebDavHelper.php b/tests/TestHelpers/WebDavHelper.php index 4cb41c0c2be8..3f4de0bb3f0a 100644 --- a/tests/TestHelpers/WebDavHelper.php +++ b/tests/TestHelpers/WebDavHelper.php @@ -413,6 +413,13 @@ public static function makeDavRequest( $user = null; $password = null; } + if ($type === "public-files-new") { + if ($password === null || $password === "") { + $user = null; + } else { + $user = "public"; + } + } $config = null; if ($sourceIpAddress !== null) { $config = [ 'curl' => [ CURLOPT_INTERFACE => $sourceIpAddress ]]; diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 2a50b435d037..57e216480e71 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -574,6 +574,7 @@ default: - PublicWebDavContext: - WebDavPropertiesContext: - TagsContext: + - TrashbinContext: apiWebdavPreviews: paths: diff --git a/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareResourceCaseSensitiveName.feature b/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareResourceCaseSensitiveName.feature index cb9346a55272..4e5381bf33fd 100644 --- a/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareResourceCaseSensitiveName.feature +++ b/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareResourceCaseSensitiveName.feature @@ -206,7 +206,7 @@ Feature: Sharing resources with different case names with the sharee and checkin Scenario: sharing file with group members that has existing folders with different case names Given group "grp1" has been created And user "Brian" has been added to group "grp1" - Given user "Alice" has uploaded the following files with content "some data" + And user "Alice" has uploaded the following files with content "some data" | path | | casesensitive.txt | | case_sensitive.txt | diff --git a/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareResourceCaseSensitiveName.feature b/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareResourceCaseSensitiveName.feature index 47d9c23a4d3c..da8f413b03d9 100644 --- a/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareResourceCaseSensitiveName.feature +++ b/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareResourceCaseSensitiveName.feature @@ -193,7 +193,7 @@ Feature: Sharing resources with different case names with the sharee and checkin Scenario: sharing folders with different case names with group members Given group "grp1" has been created And user "Brian" has been added to group "grp1" - Given user "Alice" has created the following folders + And user "Alice" has created the following folders | path | | /FO | | /F_O | @@ -238,7 +238,7 @@ Feature: Sharing resources with different case names with the sharee and checkin Scenario: sharing files and folders with different case names with group members Given group "grp1" has been created And user "Brian" has been added to group "grp1" - Given user "Alice" has uploaded the following files with content "some data" + And user "Alice" has uploaded the following files with content "some data" | path | | casesensitive.txt | | case_sensitive.txt | diff --git a/tests/acceptance/features/apiWebdavOperations/listFiles.feature b/tests/acceptance/features/apiWebdavOperations/listFiles.feature new file mode 100644 index 000000000000..ce86971e9019 --- /dev/null +++ b/tests/acceptance/features/apiWebdavOperations/listFiles.feature @@ -0,0 +1,224 @@ +@api +Feature: download file + As a user + I want to be able to list my files + So that I can understand my file structure in owncloud + + Background: + Given user "Alice" has been created with default attributes and without skeleton files + And user "Alice" has created the following folders + | path | + | simple-folder | + | simple-folder/simple-folder1 | + | simple-folder/simple-empty-folder | + | simple-folder/simple-folder1/simple-folder2 | + And user "Alice" uploads the following files with content "simple-test-content" + | path | + | textfile0.txt | + | welcome.txt | + | simple-folder/textfile0.txt | + | simple-folder/welcome.txt | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + + Scenario Outline: Get the list of all files on the root folder + Given using DAV path + When user "Alice" gets all their files on "/" with depth "0" using the using the WebDAV API + Then the HTTP status code should be "207" + And the last dav response for user "Alice" should not contain these nodes + | name | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + | simple-folder/welcome.txt | + | simple-folder/textfile0.txt | + | simple-folder/simple-empty-folder | + | simple-folder/simple-folder1 | + When user "Alice" gets all their files on "/" with depth 1 using the using the WebDAV API + Then the HTTP status code should be "207" + And the last dav response for user "Alice" should contain these nodes + | name | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + And the last dav response for user "Alice" should not contain these nodes + | name | + | simple-folder/welcome.txt | + | simple-folder/textfile0.txt | + | simple-folder/simple-empty-folder | + | simple-folder/simple-folder1 | + When user "Alice" gets all their files on "/" with depth "infinity" using the using the WebDAV API + Then the HTTP status code should be "207" + And the last dav response for user "Alice" should contain these nodes + | name | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + | simple-folder/textfile0.txt | + | simple-folder/welcome.txt | + | simple-folder/simple-folder1/ | + | simple-folder/simple-folder1/simple-folder2 | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + Examples: + | dav_version | + | old | + | new | + + Scenario Outline: Get the list of all files on a folder + Given using DAV path + When user "Alice" gets all their files on "/simple-folder" with depth "0" using the using the WebDAV API + Then the HTTP status code should be "207" + And the last dav response for user "Alice" should contain these nodes + | name | + | simple-folder/ | + And the last dav response for user "Alice" should not contain these nodes + | name | + | simple-folder/welcome.txt | + | simple-folder/textfile0.txt | + | simple-folder/simple-empty-folder | + | simple-folder/simple-folder1 | + When user "Alice" gets all their files on "/simple-folder" with depth 1 using the using the WebDAV API + Then the HTTP status code should be "207" + And the last dav response for user "Alice" should contain these nodes + | name | + | simple-folder/welcome.txt | + | simple-folder/textfile0.txt | + | simple-folder/simple-empty-folder | + | simple-folder/simple-folder1 | + And the last dav response for user "Alice" should not contain these nodes + | name | + | simple-folder/simple-folder1/simple-folder2 | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + When user "Alice" gets all their files on "/simple-folder" with depth "infinity" using the using the WebDAV API + Then the HTTP status code should be "207" + And the last dav response for user "Alice" should contain these nodes + | name | + | /simple-folder/textfile0.txt | + | /simple-folder/welcome.txt | + | /simple-folder/simple-folder1/ | + | simple-folder/simple-folder1/simple-folder2 | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + Examples: + | dav_version | + | old | + | new | + + Scenario Outline: Get the list of all files on a folder shared through public link + Given using DAV path + And user "Alice" has created the following folders + | path | + | /simple-folder/simple-folder1/simple-folder2/simple-folder3 | + | /simple-folder/simple-folder1/simple-folder2/simple-folder3/simple-folder4 | + And user "Alice" has created a public link share of folder "simple-folder" + When the public gets all files on the last created public link with depth 0 using the using the WebDAV API + Then the HTTP status code should be "207" + And the last public link dav response should not contain these nodes + | name | + | /textfile0.txt | + | /welcome.txt | + | /simple-folder1/ | + | /simple-folder1/welcome.txt | + | /simple-folder1/simple-folder2 | + | /simple-folder1/textfile0.txt | + | /simple-folder1/simple-folder2/textfile0.txt | + | /simple-folder1/simple-folder2/welcome.txt | + | /simple-folder1/simple-folder2/simple-folder3 | + | /simple-folder1/simple-folder2/simple-folder3/simple-folder4 | + When the public gets all files on the last created public link with depth 1 using the using the WebDAV API + Then the HTTP status code should be "207" + And the last public link dav response should contain these nodes + | name | + | /textfile0.txt | + | /welcome.txt | + | /simple-folder1/ | + And the last public link dav response should not contain these nodes + | name | + | /simple-folder1/simple-folder2/textfile0.txt | + | /simple-folder1/simple-folder2/welcome.txt | + | /simple-folder1/simple-folder2/simple-folder3 | + | /simple-folder1/welcome.txt | + | /simple-folder1/simple-folder2 | + | /simple-folder1/textfile0.txt | + | /simple-folder1/simple-folder2/simple-folder3/simple-folder4 | + When the public gets all files on the last created public link with depth infinity using the using the WebDAV API + Then the HTTP status code should be "207" + And the last public link dav response should contain these nodes + | name | + | /textfile0.txt | + | /welcome.txt | + | /simple-folder1/ | + | /simple-folder1/welcome.txt | + | /simple-folder1/simple-folder2 | + | /simple-folder1/textfile0.txt | + | /simple-folder1/simple-folder2/textfile0.txt | + | /simple-folder1/simple-folder2/welcome.txt | + | /simple-folder1/simple-folder2/simple-folder3 | + | /simple-folder1/simple-folder2/simple-folder3/simple-folder4 | + Examples: + | dav_version | + | old | + | new | + + Scenario: Get the list of all files on a folder on trashbin + Given using new DAV path + And user "Alice" has deleted the following resources + | path | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + When user "Alice" gets files on the trashbin path "/" with depth 0 using the using the WebDAV API + Then the HTTP status code should be "207" + And the trashbin dav response should not contain these nodes + | name | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + | simple-folder/textfile0.txt | + | simple-folder/welcome.txt | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + When user "Alice" gets files on the trashbin path "/" with depth 1 using the using the WebDAV API + Then the HTTP status code should be "207" + And the trashbin dav response should contain these nodes + | name | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + And the trashbin dav response should not contain these nodes + | name | + | simple-folder/textfile0.txt | + | simple-folder/welcome.txt | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + When user "Alice" gets files on the trashbin path "/" with depth infinity using the using the WebDAV API + Then the HTTP status code should be "207" + And the trashbin dav response should contain these nodes + | name | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + | simple-folder/textfile0.txt | + | simple-folder/welcome.txt | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | +# Examples: +# | dav_version | +# | old | +# | new | diff --git a/tests/acceptance/features/bootstrap/FeatureContext.php b/tests/acceptance/features/bootstrap/FeatureContext.php index db463821bc52..dc677a2120a6 100644 --- a/tests/acceptance/features/bootstrap/FeatureContext.php +++ b/tests/acceptance/features/bootstrap/FeatureContext.php @@ -2786,6 +2786,14 @@ public function substituteInLineCodes( "getLastShareId" ], "parameter" => [] + ], + [ + "code" => "%last_share_token%", + "function" => [ + $this, + "getLastSharetoken" + ], + "parameter" => [] ] ]; if ($user !== null) { @@ -2831,6 +2839,10 @@ public function substituteInLineCodes( } foreach ($substitutions as $substitution) { + if (strpos($value, $substitution['code']) === false) { + continue; + } + $replacement = \call_user_func_array( $substitution["function"], $substitution["parameter"] diff --git a/tests/acceptance/features/bootstrap/TrashbinContext.php b/tests/acceptance/features/bootstrap/TrashbinContext.php index 37d22422b521..14629d861c68 100644 --- a/tests/acceptance/features/bootstrap/TrashbinContext.php +++ b/tests/acceptance/features/bootstrap/TrashbinContext.php @@ -141,19 +141,21 @@ static function (SimpleXMLElement $propStat) { * @param string $path path * @param string $asUser - To send request as another user * @param string $password + * @param string|int $depth * * @return array response */ - public function listTrashbinFolder($user, $path, $asUser = null, $password = null) { + public function listTrashbinFolder($user, $path, $asUser = null, $password = null, $depth="infinity") { $asUser = $asUser ?? $user; $path = $path ?? '/'; $password = $password ?? $this->featureContext->getPasswordForUser($asUser); + $depth = (string)$depth; $response = WebDavHelper::listFolder( $this->featureContext->getBaseUrl(), $asUser, $password, "/trash-bin/$user/$path", - "infinity", + $depth, [ 'oc:trashbin-original-filename', 'oc:trashbin-original-location', @@ -162,6 +164,7 @@ public function listTrashbinFolder($user, $path, $asUser = null, $password = nul ], 'trash-bin' ); + $this->featureContext->setResponse($response); $responseXml = HttpRequestHelper::getResponseXml( $response, __METHOD__ @@ -183,6 +186,99 @@ static function ($element) use ($user, $path) { return $files; } + /** + * @When user :user gets files on the trashbin path :path with depth :depth using the using the WebDAV API + * + * @param $user + * @param $path + * @param $depth + * + * @return void + */ + public function userGetsFilesOnTheTrashbinWithDepthUsingTheUsingTheWebdavApi($user, $path, $depth) { + if ($path === "/" || $path === "") { + $this->listTrashbinFolder($user, $path, null, null, $depth); + return; + } + $techPreviewHadToBeEnabled = $this->occContext->enableDAVTechPreview(); + $listing = $this->listTrashbinFolder($user, null); + if ($techPreviewHadToBeEnabled) { + $this->occContext->disableDAVTechPreview(); + } + $originalPath = \trim($path, '/'); + if ($originalPath == "") { + $originalPath = null; + } + + $trashEntry = null; + foreach ($listing as $entry) { + if ($entry['original-location'] === $originalPath) { + $trashEntry = $entry; + break; + } + } + + Assert::assertNotNull( + $trashEntry, + "The first trash entry was not found while looking for trashbin entry '$path' of user '$user'" + ); + $topPath = "/" . $this->featureContext->getBasePath() . "/remote.php/dav/trash-bin/$user"; + $topPath = WebDavHelper::sanitizeUrl($topPath); + $path = str_replace($topPath, "", $trashEntry["href"]); + + $this->listTrashbinFolder($user, $path, null, null, $depth); + } + + /** + * @Then the trashbin dav response should not contain these nodes + * + * @param TableNode $table + * + * @return void + */ + public function theTrashbinDavResponseShouldNotContainTheseNodes(TableNode $table) { + $this->featureContext->verifyTableNodeColumns($table, ['name']); + $responseXml = $this->featureContext->getResponseXmlObject(); + $files = $this->getTrashbinContentFromResponseXml($responseXml); + + foreach ($table->getHash() as $row) { + $path = trim($row['name'], "/"); + foreach ($files as $file) { + if (trim($file['original-location'], "/") === $path) { + throw new Exception("file $path was not expected in trashbin response but was found"); + } + } + } + } + + /** + * @Then the trashbin dav response should contain these nodes + * + * @param TableNode $table + * + * @return void + */ + public function theTrashbinDavResponseShouldContainTheseNodes(TableNode $table) { + $this->featureContext->verifyTableNodeColumns($table, ['name']); + $responseXml = $this->featureContext->getResponseXmlObject(); + + $files = $this->getTrashbinContentFromResponseXml($responseXml); + + foreach ($table->getHash() as $row) { + $path = trim($row['name'], "/"); + $found = false; + foreach ($files as $file) { + if (trim($file['original-location'], "/") === $path) { + $found = true; + break; + } + } + if (!$found) { + throw new Exception("file $path was expected in trashbin response but was not found"); + } + } + } + /** * Send a webdav request to list the trashbin content * @@ -520,7 +616,10 @@ public function asFileOrFolderExistsInTrash($user, $path) { */ private function isInTrash($user, $originalPath) { $techPreviewHadToBeEnabled = $this->occContext->enableDAVTechPreview(); + $res = $this->featureContext->getResponse(); $listing = $this->listTrashbinFolder($user, null); + + $this->featureContext->setResponse($res); if ($techPreviewHadToBeEnabled) { $this->occContext->disableDAVTechPreview(); } @@ -671,9 +770,10 @@ public function contentOfFileForUserIfAlsoInTrashShouldBeOtherwise( $content, $alternativeContent ) { + $isInTrash = $this->isInTrash($user, $fileName); $user = $this->featureContext->getActualUsername($user); $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName); - if ($this->isInTrash($user, $fileName)) { + if ($isInTrash) { $this->featureContext->downloadedContentShouldBe($content); } else { $this->featureContext->downloadedContentShouldBe($alternativeContent); diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 554c5790bf2c..639c733d7585 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -258,6 +258,19 @@ public function getFullDavFilesPath($user) { return \ltrim($path, "/"); } + /** + * @param string $token + * @param string $type + * + * @return string + */ + public function getPublicLinkDavPath($token, $type) { + $path = $this->getBasePath() . "/" . + WebDavHelper::getDavPath($token, $this->getDavPathVersion(), $type); + $path = WebDavHelper::sanitizeUrl($path); + return \ltrim($path, "/"); + } + /** * Select a suitable dav path version number. * Some endpoints have only existed since a certain point in time, so for @@ -2968,7 +2981,7 @@ public function userHasDeletedFile($user, $deletedOrUnshared, $fileOrFolder, $en } /** - * @Given /^user "([^"]*)" has (deleted|unshared) the following (files|folders)$/ + * @Given /^user "([^"]*)" has (deleted|unshared) the following (files|folders|resources)$/ * * @param string $user * @param string $deletedOrUnshared @@ -4345,6 +4358,115 @@ function ($value) { } } + /** + * @When user :arg1 gets all their files on :path with depth :depth using the using the WebDAV API + * + * @param $user + * @param $path + * @param $depth + * + * @return void + */ + public function userGetsAllTheirFilesUsingTheUsingTheWebdavApi($user, $path, $depth) { + $response = $this->listFolder( + $user, + $path, + $depth + ); + $this->setResponse($response); + $this->setResponseXml(HttpRequestHelper::parseResponseAsXml($this->response)); + } + + /** + * @Then the last dav response for user :user should contain these nodes/elements + * + * @param $user + * @param TableNode $table + * + * @return void + */ + public function theLastDavResponseShouldContainTheseNodes($user, TableNode $table) { + $this->verifyTableNodeColumns($table, ["name"]); + foreach ($table->getHash() as $row) { + $path = $this->substituteInLineCodes($row['name']); + $res = $this->findEntryFromPropfindResponse($path, $user); + Assert::assertNotFalse($res, "expected $path to be in dav response but was not found"); + } + } + + /** + * @Then the last dav response for user :user should not contain these nodes/elements + * + * @param $user + * @param TableNode $table + * + * @return void + */ + public function theLastDavResponseShouldNotContainTheseNodes($user, TableNode $table) { + $this->verifyTableNodeColumns($table, ["name"]); + foreach ($table->getHash() as $row) { + $path = $this->substituteInLineCodes($row['name']); + $res = $this->findEntryFromPropfindResponse($path, $user); + Assert::assertFalse($res, "expected $path to not be in dav response but was found"); + } + } + + /** + * @Then the last public link dav response should contain these nodes/elements + * + * @param TableNode $table + * + * @return void + */ + public function theLastPublicDavResponseShouldContainTheseNodes(TableNode $table) { + $user = (string) $this->getLastShareData()->data->token; + $this->verifyTableNodeColumns($table, ["name"]); + $type = $this->usingOldDavPath ? "public-files" : "public-files-new"; + foreach ($table->getHash() as $row) { + $path = $this->substituteInLineCodes($row['name']); + $res = $this->findEntryFromPropfindResponse($path, $user, $type); + Assert::assertNotFalse($res, "expected $path to be in dav response but was not found"); + } + } + + /** + * @Then the last public link dav response should not contain these nodes/elements + * + * @param TableNode $table + * + * @return void + */ + public function theLastPublicDavResponseShouldNotContainTheseNodes(TableNode $table) { + $user = (string) $this->getLastShareData()->data->token; + $this->verifyTableNodeColumns($table, ["name"]); + $type = $this->usingOldDavPath ? "public-files" : "public-files-new"; + foreach ($table->getHash() as $row) { + $path = $this->substituteInLineCodes($row['name']); + $res = $this->findEntryFromPropfindResponse($path, $user, $type); + Assert::assertFalse($res, "expected $path to not be in dav response but was found"); + } + } + + /** + * @When the public gets all files on the last created public link with depth :depth using the using the WebDAV API + * + * @param $depth + * + * @return void + */ + public function thePublicGetsAllFilesOnTheLastCreatedPublicLinkWithDepthUsingTheUsingTheWebdavApi($depth) { + $user = (string) $this->getLastShareData()->data->token; + $response = $this->listFolder( + $user, + '/', + $depth, + null, + $this->usingOldDavPath ? "public-files" : "public-files-new" + ); + $this->setResponse($response); + $this->setResponseXml(HttpRequestHelper::parseResponseAsXml($this->response)); + } + /** * @param string|null $user * @@ -4372,6 +4494,7 @@ public function findEntryFromReportResponse($user) { * * @param string $entryNameToSearch * @param string|null $user + * @param string $type * * @return string|array|boolean * string if $entryNameToSearch is given and is found @@ -4380,7 +4503,8 @@ public function findEntryFromReportResponse($user) { */ public function findEntryFromPropfindResponse( $entryNameToSearch = null, - $user = null + $user = null, + $type = "files" ) { //if we are using that step the second time in a scenario e.g. 'But ... should not' //then don't parse the result again, because the result in a ResponseInterface @@ -4399,6 +4523,18 @@ public function findEntryFromPropfindResponse( // topWebDavPath should be something like /remote.php/webdav/ or // /remote.php/dav/files/alice/ $topWebDavPath = "/" . $this->getFullDavFilesPath($user) . "/"; + + switch ($type) { + case "files": + break; + case "public-files": + case "public-files-old": + case "public-files-new": + $topWebDavPath = "/" . $this->getPublicLinkDavPath($user, $type) . "/"; + break; + default: + throw new Exception("error"); + } Assert::assertIsArray( $this->responseXml, __METHOD__ . " responseXml for user $user is not an array" @@ -4415,6 +4551,7 @@ public function findEntryFromPropfindResponse( $entryPath = $multistatusResult['value'][0]['value']; $entryName = \str_replace($topWebDavPath, "", $entryPath); $entryName = \rawurldecode($entryName); + $entryName = \trim($entryName, "/"); if ($trimmedEntryNameToSearch === $entryName) { return $multistatusResult; } diff --git a/tests/acceptance/features/webUIAddUsers/addUsers.feature b/tests/acceptance/features/webUIAddUsers/addUsers.feature index 25be695344e2..3eb84ee01df9 100644 --- a/tests/acceptance/features/webUIAddUsers/addUsers.feature +++ b/tests/acceptance/features/webUIAddUsers/addUsers.feature @@ -100,7 +100,7 @@ Feature: add users Then the user should see an error message saying "The token provided is invalid." And the user follows the password set link received by "guiusr1@owncloud" in Email number 1 using the webUI And the user sets the password to "%regular%" and confirms with the same password using the webUI - Then the user should be redirected to the login page + And the user should be redirected to the login page And the email address "guiusr1@owncloud" should have received an email with the body containing """ Password changed successfully