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:
authorVincent Petry <pvince81@owncloud.com>2016-11-25 11:46:37 +0300
committerGitHub <noreply@github.com>2016-11-25 11:46:37 +0300
commitfc7abeb05d9ea63b0cd7dfb8e6a6e0c4c6f15aa3 (patch)
tree5466c2131a6dd6020acac4f8c00d0c7df546c806 /build
parent6962047e923ed77a5ca912fa6c90f760736dfb17 (diff)
parent65af3785ab5e1d780598874b3553c93767447f1f (diff)
Merge pull request #26696 from owncloud/stable9-publicupload-fix
[stable9] Properly convert OCS params + more tests
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/Sharing.php30
-rw-r--r--build/integration/features/sharing-v1.feature175
2 files changed, 205 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php
index 2c8c1798250..973d3bc3c92 100644
--- a/build/integration/features/bootstrap/Sharing.php
+++ b/build/integration/features/bootstrap/Sharing.php
@@ -254,6 +254,7 @@ trait Sharing {
* @param string $filename
*/
public function checkSharedFileInResponse($filename){
+ $filename = ltrim($filename, '/');
PHPUnit_Framework_Assert::assertEquals(True, $this->isFieldInResponse('file_target', "/$filename"));
}
@@ -263,10 +264,31 @@ trait Sharing {
* @param string $filename
*/
public function checkSharedFileNotInResponse($filename){
+ $filename = ltrim($filename, '/');
PHPUnit_Framework_Assert::assertEquals(False, $this->isFieldInResponse('file_target', "/$filename"));
}
/**
+ * @Then /^File "([^"]*)" should be included as path in the response$/
+ *
+ * @param string $filename
+ */
+ public function checkSharedFileAsPathInResponse($filename){
+ $filename = ltrim($filename, '/');
+ PHPUnit_Framework_Assert::assertEquals(True, $this->isFieldInResponse('path', "/$filename"));
+ }
+
+ /**
+ * @Then /^File "([^"]*)" should not be included as path in the response$/
+ *
+ * @param string $filename
+ */
+ public function checkSharedFileAsPathNotInResponse($filename){
+ $filename = ltrim($filename, '/');
+ PHPUnit_Framework_Assert::assertEquals(False, $this->isFieldInResponse('path', "/$filename"));
+ }
+
+ /**
* @Then /^User "([^"]*)" should be included in the response$/
*
* @param string $user
@@ -385,6 +407,14 @@ trait Sharing {
}
/**
+ * @Then /^the response contains ([0-9]+) entries$/
+ */
+ public function checkingTheResponseEntriesCount($count){
+ $actualCount = count($this->response->xml()->data[0]);
+ PHPUnit_Framework_Assert::assertEquals($count, $actualCount);
+ }
+
+ /**
* @Then /^Share fields of last share match with$/
* @param \Behat\Gherkin\Node\TableNode|null $body
*/
diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature
index 7d773b6fe23..1611c930ff0 100644
--- a/build/integration/features/sharing-v1.feature
+++ b/build/integration/features/sharing-v1.feature
@@ -766,6 +766,66 @@ Feature: sharing
Then the OCS status code should be "100"
And the HTTP status code should be "200"
+ Scenario: sharing subfolder when parent already shared
+ Given As an "admin"
+ Given user "user0" exists
+ Given user "user1" exists
+ And group "sharing-group" exists
+ And user "user0" created a folder "/test"
+ And user "user0" created a folder "/test/sub"
+ And file "/test" of user "user0" is shared with group "sharing-group"
+ And As an "user0"
+ When sending "POST" to "/apps/files_sharing/api/v1/shares" with
+ | path | /test/sub |
+ | shareWith | user1 |
+ | shareType | 0 |
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And as "user1" the folder "/sub" exists
+
+ Scenario: sharing subfolder when parent already shared with group of sharer
+ Given As an "admin"
+ Given user "user0" exists
+ Given user "user1" exists
+ And group "sharing-group" exists
+ And user "user0" belongs to group "sharing-group"
+ And user "user0" created a folder "/test"
+ And user "user0" created a folder "/test/sub"
+ And file "/test" of user "user0" is shared with group "sharing-group"
+ And As an "user0"
+ When sending "POST" to "/apps/files_sharing/api/v1/shares" with
+ | path | /test/sub |
+ | shareWith | user1 |
+ | shareType | 0 |
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And as "user1" the folder "/sub" exists
+
+ Scenario: sharing subfolder of already shared folder, GET result is correct
+ Given As an "admin"
+ Given user "user0" exists
+ Given user "user1" exists
+ Given user "user2" exists
+ Given user "user3" exists
+ Given user "user4" exists
+ And user "user0" created a folder "/folder1"
+ And file "/folder1" of user "user0" is shared with user "user1"
+ And file "/folder1" of user "user0" is shared with user "user2"
+ And user "user0" created a folder "/folder1/folder2"
+ And file "/folder1/folder2" of user "user0" is shared with user "user3"
+ And file "/folder1/folder2" of user "user0" is shared with user "user4"
+ And As an "user0"
+ When sending "GET" to "/apps/files_sharing/api/v1/shares"
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And the response contains 4 entries
+ And File "/folder1" should be included as path in the response
+ And File "/folder1/folder2" should be included as path in the response
+ And sending "GET" to "/apps/files_sharing/api/v1/shares?path=/folder1/folder2"
+ And the response contains 2 entries
+ And File "/folder1" should not be included as path in the response
+ And File "/folder1/folder2" should be included as path in the response
+
Scenario: unshare from self
Given As an "admin"
And user "user0" exists
@@ -780,3 +840,118 @@ Feature: sharing
When Deleting last share
Then etag of element "/" of user "user1" has changed
And etag of element "/PARENT" of user "user0" has not changed
+
+ Scenario: Increasing permissions is allowed for owner
+ Given As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And group "new-group" exists
+ And user "user0" belongs to group "new-group"
+ And user "user1" belongs to group "new-group"
+ And Assure user "user0" is subadmin of group "new-group"
+ And As an "user0"
+ And folder "/FOLDER" of user "user0" is shared with group "new-group"
+ And Updating last share with
+ | permissions | 0 |
+ When Updating last share with
+ | permissions | 31 |
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+
+ Scenario: Adding public upload to a read only shared folder as recipient is not allowed
+ Given As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user0"
+ And user "user0" created a folder "/test"
+ And folder "/test" of user "user0" is shared with user "user1" with permissions 17
+ And As an "user1"
+ And creating a share with
+ | path | /test |
+ | shareType | 3 |
+ | publicUpload | false |
+ When Updating last share with
+ | publicUpload | true |
+ Then the OCS status code should be "404"
+ And the HTTP status code should be "200"
+
+ Scenario: Adding public upload to a shared folder as recipient is allowed with permissions
+ Given As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user0"
+ And user "user0" created a folder "/test"
+ And folder "/test" of user "user0" is shared with user "user1" with permissions 31
+ And As an "user1"
+ And creating a share with
+ | path | /test |
+ | shareType | 3 |
+ | publicUpload | false |
+ When Updating last share with
+ | publicUpload | true |
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+
+ Scenario: Adding public upload to a read only shared folder as recipient is not allowed
+ Given As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user0"
+ And user "user0" created a folder "/test"
+ And folder "/test" of user "user0" is shared with user "user1" with permissions 17
+ And As an "user1"
+ And creating a share with
+ | path | /test |
+ | shareType | 3 |
+ | permissions | 1 |
+ When Updating last share with
+ | permissions | 7 |
+ Then the OCS status code should be "404"
+ And the HTTP status code should be "200"
+
+ Scenario: Adding public upload to a shared folder as recipient is allowed with permissions
+ Given As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user0"
+ And user "user0" created a folder "/test"
+ And folder "/test" of user "user0" is shared with user "user1" with permissions 31
+ And As an "user1"
+ And creating a share with
+ | path | /test |
+ | shareType | 3 |
+ | permissions | 1 |
+ When Updating last share with
+ | permissions | 7 |
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+
+ Scenario: resharing using a public link with read only permissions is not allowed
+ Given As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user0"
+ And user "user0" created a folder "/test"
+ And folder "/test" of user "user0" is shared with user "user1" with permissions 1
+ And As an "user1"
+ And creating a share with
+ | path | /test |
+ | shareType | 3 |
+ | publicUpload | false |
+ Then the OCS status code should be "404"
+ And the HTTP status code should be "200"
+
+ Scenario: resharing using a public link with read and write permissions only is not allowed
+ Given As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user0"
+ And user "user0" created a folder "/test"
+ And folder "/test" of user "user0" is shared with user "user1" with permissions 15
+ And As an "user1"
+ And creating a share with
+ | path | /test |
+ | shareType | 3 |
+ | publicUpload | false |
+ Then the OCS status code should be "404"
+ And the HTTP status code should be "200"