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:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-03-17 17:50:33 +0300
committerVincent Petry <pvince81@owncloud.com>2016-03-18 13:37:56 +0300
commit26deb0a8979b65e47b3f107fc237758590f67de4 (patch)
tree288eaa89f9758f70cd469c390510a3b3af9ee64e /build
parent3c77311397e49282cef6e77a4f0c52bd67522edc (diff)
Add intergration tests
Intergration tests to ensure the share-types property is set correctly. * Unshared item * Shared with user * Shared with group * Shared by link * Shared with user & group & link
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/WebDav.php55
-rw-r--r--build/integration/features/webdav-related.feature73
2 files changed, 126 insertions, 2 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index 0430768022c..0a4624ccc2b 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -168,8 +168,8 @@ trait WebDav {
*/
public function theSingleResponseShouldContainAPropertyWithValue($key, $expectedValue) {
$keys = $this->response;
- if (!isset($keys[$key])) {
- throw new \Exception("Cannot find property \"$key\" with \"$expectedalue\"");
+ if (!array_key_exists($key, $keys)) {
+ throw new \Exception("Cannot find property \"$key\" with \"$expectedValue\"");
}
$value = $keys[$key];
@@ -178,6 +178,57 @@ trait WebDav {
}
}
+ /**
+ * @Then the response should contain a share-types property with
+ */
+ public function theResponseShouldContainAShareTypesPropertyWith($table)
+ {
+ $keys = $this->response;
+ if (!array_key_exists('{http://owncloud.org/ns}share-types', $keys)) {
+ throw new \Exception("Cannot find property \"{http://owncloud.org/ns}share-types\"");
+ }
+
+ $foundTypes = [];
+ $data = $keys['{http://owncloud.org/ns}share-types'];
+ foreach ($data as $item) {
+ if ($item['name'] !== '{http://owncloud.org/ns}share-type') {
+ throw new \Exception('Invalid property found: "' . $item['name'] . '"');
+ }
+
+ $foundTypes[] = $item['value'];
+ }
+
+ foreach ($table->getRows() as $row) {
+ $key = array_search($row[0], $foundTypes);
+ if ($key === false) {
+ throw new \Exception('Expected type ' . $row[0] . ' not found');
+ }
+
+ unset($foundTypes[$key]);
+ }
+
+ if ($foundTypes !== []) {
+ throw new \Exception('Found more share types then specified: ' . $foundTypes);
+ }
+ }
+
+ /**
+ * @Then the response should contain an empty property :property
+ * @param string $property
+ * @throws \Exception
+ */
+ public function theResponseShouldContainAnEmptyProperty($property) {
+ $properties = $this->response;
+ if (!array_key_exists($property, $properties)) {
+ throw new \Exception("Cannot find property \"$property\"");
+ }
+
+ if ($properties[$property] !== null) {
+ throw new \Exception("Property \"$property\" is not empty");
+ }
+ }
+
+
/*Returns the elements of a propfind, $folderDepth requires 1 to see elements without children*/
public function listFolder($user, $path, $folderDepth, $properties = null){
$fullUrl = substr($this->baseUrl, 0, -4);
diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature
index 019df3436f8..ee841f9eb5b 100644
--- a/build/integration/features/webdav-related.feature
+++ b/build/integration/features/webdav-related.feature
@@ -168,3 +168,76 @@ Feature: webdav-related
When As an "user0"
And Downloading file "/myChunkedFile.txt"
Then Downloaded content should be "AAAAABBBBBCCCCC"
+
+ Scenario: A file that is not shared does not have a share-types property
+ Given user "user0" exists
+ And user "user0" created a folder "/test"
+ When as "user0" gets properties of folder "/test" with
+ |{http://owncloud.org/ns}share-types|
+ Then the response should contain an empty property "{http://owncloud.org/ns}share-types"
+
+ Scenario: A file that is shared to a user has a share-types property
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user0" created a folder "/test"
+ And as "user0" creating a share with
+ | path | test |
+ | shareType | 0 |
+ | permissions | 31 |
+ | shareWith | user1 |
+ When as "user0" gets properties of folder "/test" with
+ |{http://owncloud.org/ns}share-types|
+ Then the response should contain a share-types property with
+ | 0 |
+
+ Scenario: A file that is shared to a group has a share-types property
+ Given user "user0" exists
+ And group "group1" exists
+ And user "user0" created a folder "/test"
+ And as "user0" creating a share with
+ | path | test |
+ | shareType | 1 |
+ | permissions | 31 |
+ | shareWith | group1 |
+ When as "user0" gets properties of folder "/test" with
+ |{http://owncloud.org/ns}share-types|
+ Then the response should contain a share-types property with
+ | 1 |
+
+ Scenario: A file that is shared by link has a share-types property
+ Given user "user0" exists
+ And user "user0" created a folder "/test"
+ And as "user0" creating a share with
+ | path | test |
+ | shareType | 3 |
+ | permissions | 31 |
+ When as "user0" gets properties of folder "/test" with
+ |{http://owncloud.org/ns}share-types|
+ Then the response should contain a share-types property with
+ | 3 |
+
+ Scenario: A file that is shared by user,group and link has a share-types property
+ Given user "user0" exists
+ And user "user1" exists
+ And group "group2" exists
+ And user "user0" created a folder "/test"
+ And as "user0" creating a share with
+ | path | test |
+ | shareType | 0 |
+ | permissions | 31 |
+ | shareWith | user1 |
+ And as "user0" creating a share with
+ | path | test |
+ | shareType | 1 |
+ | permissions | 31 |
+ | shareWith | group2 |
+ And as "user0" creating a share with
+ | path | test |
+ | shareType | 3 |
+ | permissions | 31 |
+ When as "user0" gets properties of folder "/test" with
+ |{http://owncloud.org/ns}share-types|
+ Then the response should contain a share-types property with
+ | 0 |
+ | 1 |
+ | 3 |