Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorDavid Toledo <dtoledo@solidgear.es>2016-04-25 17:00:19 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2016-06-15 15:21:59 +0300
commit39a56c7bc165cc782142a0a92fe1ec8423ecfa3d (patch)
treed95acdbb17fafd58c3bcb00c1010d97cf7975de5 /build
parent5de6432441df09d9450457f242eb4a65a60b40dc (diff)
Added favorites integration tests
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/WebDav.php40
-rw-r--r--build/integration/features/favorites.feature23
2 files changed, 62 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index cd9584ad186..a63e2a59218 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -434,5 +434,43 @@ trait WebDav {
$this->response = $ex->getResponse();
}
}
-}
+ /*
+ * @When user "([^"]*)" favorites folder "([^"]*)"
+ * @param string $user
+ * @param string $path
+ * @param \Behat\Gherkin\Node\TableNode|null $propertiesTable
+ */
+ public function userFavoritesFolder($user, $path, $propertiesTable) {
+ $properties = null;
+ if ($propertiesTable instanceof \Behat\Gherkin\Node\TableNode) {
+ foreach ($propertiesTable->getRows() as $row) {
+ $properties[] = $row[0];
+ }
+ }
+ $this->response = $this->favFolder($user, $path, 0, $properties);
+ }
+
+ /*Set the elements of a proppatch, $folderDepth requires 1 to see elements without children*/
+ public function favFolder($user, $path, $folderDepth, $properties = null){
+ $fullUrl = substr($this->baseUrl, 0, -4);
+ $settings = array(
+ 'baseUri' => $fullUrl,
+ 'userName' => $user,
+ );
+ if ($user === 'admin') {
+ $settings['password'] = $this->adminUser[1];
+ } else {
+ $settings['password'] = $this->regularUser;
+ }
+ $client = new SClient($settings);
+ if (!$properties) {
+ $properties = [
+ '{http://owncloud.org/ns}favorite'
+ ];
+ }
+ echo $properties,
+ $response = $client->proppatch($this->davPath . '/' . ltrim($path, '/'), $properties, $folderDepth);
+ return $response;
+ }
+}
diff --git a/build/integration/features/favorites.feature b/build/integration/features/favorites.feature
new file mode 100644
index 00000000000..4b437d13bd5
--- /dev/null
+++ b/build/integration/features/favorites.feature
@@ -0,0 +1,23 @@
+Feature: favorite
+ Background:
+ Given using api version "1"
+
+ Scenario: Retrieving favorite info of a folder
+ Given using dav path "remote.php/webdav"
+ And As an "admin"
+ And user "user0" exists
+ When user "user0" favorites folder "/"
+ |{http://owncloud.org/ns}favorite|
+ Then As "user0" gets properties of folder "/" with
+ |{http://owncloud.org/ns}favorite|
+ And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1"
+
+ Scenario: Retrieving favorite info of a file
+ Given using dav path "remote.php/webdav"
+ And As an "admin"
+ And user "user0" exists
+ When user "user0" favorites folder "/textfile0.txt"
+ |{http://owncloud.org/ns}favorite|
+ Then As "user0" gets properties of folder "/textfile0.txt" with
+ |{http://owncloud.org/ns}favorite|
+ And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1" \ No newline at end of file