diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-11-20 15:41:15 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-11-20 15:47:11 +0100 |
commit | 54f8f75f6f82ca102b1cfdb88caf0d06e6c9ba31 (patch) | |
tree | 814b8e63ae34721af895079b6bc55673189ce911 /build/integration/features | |
parent | 9004e90f5de9a72264425d8a26c88af15f0d27ec (diff) | |
download | nextcloud-server-54f8f75f6f82ca102b1cfdb88caf0d06e6c9ba31.tar.gz nextcloud-server-54f8f75f6f82ca102b1cfdb88caf0d06e6c9ba31.zip |
Accept incoming shares in integration tests
Now all incoming shares need to be explicitly accepted before being able
to use the shared file or get information about a reshare (although
getting the information of the incoming share is possible before
accepting it).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'build/integration/features')
-rw-r--r-- | build/integration/features/bootstrap/Sharing.php | 33 | ||||
-rw-r--r-- | build/integration/features/comments-search.feature | 5 | ||||
-rw-r--r-- | build/integration/features/comments.feature | 6 | ||||
-rw-r--r-- | build/integration/features/dav-v2.feature | 1 | ||||
-rw-r--r-- | build/integration/features/external-storage.feature | 1 | ||||
-rw-r--r-- | build/integration/features/favorites.feature | 1 | ||||
-rw-r--r-- | build/integration/features/tags.feature | 19 | ||||
-rw-r--r-- | build/integration/features/transfer-ownership.feature | 14 | ||||
-rw-r--r-- | build/integration/features/webdav-related.feature | 10 |
9 files changed, 90 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 42d2f03221f..7575f8a8029 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -112,6 +112,39 @@ trait Sharing { } /** + * @When /^accepting last share$/ + */ + public function acceptingLastShare() { + $share_id = $this->lastShareData->data[0]->id; + $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/pending/$share_id"; + $this->sendingToWith("POST", $url, null); + + $this->theHTTPStatusCodeShouldBe('200'); + } + + /** + * @When /^user "([^"]*)" accepts last share$/ + * + * @param string $user + */ + public function userAcceptsLastShare(string $user) { + // "As userXXX" and "user userXXX accepts last share" steps are not + // expected to be used in the same scenario, but restore the user just + // in case. + $previousUser = $this->currentUser; + + $this->currentUser = $user; + + $share_id = $this->lastShareData->data[0]->id; + $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/pending/$share_id"; + $this->sendingToWith("POST", $url, null); + + $this->currentUser = $previousUser; + + $this->theHTTPStatusCodeShouldBe('200'); + } + + /** * @Then /^Public shared file "([^"]*)" can be downloaded$/ */ public function checkPublicSharedFile($filename) { diff --git a/build/integration/features/comments-search.feature b/build/integration/features/comments-search.feature index 333407399d1..a1d116ee3f4 100644 --- a/build/integration/features/comments-search.feature +++ b/build/integration/features/comments-search.feature @@ -24,6 +24,7 @@ Feature: comments-search | path | sharedFileToComment.txt | | shareWith | user0 | | shareType | 0 | + And user "user0" accepts last share And "user0" posts a comment with content "My first comment" on the file named "/sharedFileToComment.txt" it should return "201" When Logging in using web as "user0" And searching for "first" in app "files" @@ -45,6 +46,7 @@ Feature: comments-search | path | mySharedFileToComment.txt | | shareWith | user1 | | shareType | 0 | + And user "user1" accepts last share And "user1" posts a comment with content "Other's first comment" on the file named "/mySharedFileToComment.txt" it should return "201" When Logging in using web as "user0" And searching for "first" in app "files" @@ -66,6 +68,7 @@ Feature: comments-search | path | sharedFileToComment.txt | | shareWith | user0 | | shareType | 0 | + And user "user0" accepts last share And "user1" posts a comment with content "Other's first comment" on the file named "/sharedFileToComment.txt" it should return "201" When Logging in using web as "user0" And searching for "first" in app "files" @@ -179,11 +182,13 @@ Feature: comments-search | path | mySharedFileToComment.txt | | shareWith | user1 | | shareType | 0 | + And user "user1" accepts last share And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt" And as "user1" creating a share with | path | sharedFileToComment.txt | | shareWith | user0 | | shareType | 0 | + And user "user0" accepts last share And "user0" posts a comment with content "My first comment to be found" on the file named "/myFileToComment.txt" it should return "201" And "user0" posts a comment with content "The second comment should not be found" on the file named "/myFileToComment.txt" it should return "201" And "user0" posts a comment with content "My first comment to be found" on the file named "/mySharedFileToComment.txt" it should return "201" diff --git a/build/integration/features/comments.feature b/build/integration/features/comments.feature index cc95d24761d..0f3a4cc75cf 100644 --- a/build/integration/features/comments.feature +++ b/build/integration/features/comments.feature @@ -22,6 +22,7 @@ Feature: comments | path | myFileToComment.txt | | shareWith | 12345 | | shareType | 0 | + Given user "12345" accepts last share When "12345" posts a comment with content "A comment from another user" on the file named "/myFileToComment.txt" it should return "201" Then As "12345" load all the comments of the file named "/myFileToComment.txt" it should return "207" And the response should contain a property "oc:parentId" with value "0" @@ -72,6 +73,7 @@ Feature: comments | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 | + And user "user1" accepts last share Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201" When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207" Then the response should contain a property "oc:parentId" with value "0" @@ -94,6 +96,7 @@ Feature: comments | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 | + And user "user1" accepts last share Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201" When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207" Then the response should contain a property "oc:parentId" with value "0" @@ -139,6 +142,7 @@ Feature: comments | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 | + And user "user1" accepts last share Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201" When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207" Then the response should contain a property "oc:parentId" with value "0" @@ -167,6 +171,7 @@ Feature: comments | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 | + And user "user1" accepts last share When "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201" Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207" And the response should contain a property "oc:parentId" with value "0" @@ -196,6 +201,7 @@ Feature: comments | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 | + And user "user1" accepts last share Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201" When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207" Then the response should contain a property "oc:parentId" with value "0" diff --git a/build/integration/features/dav-v2.feature b/build/integration/features/dav-v2.feature index ad24c9b5931..5405510283f 100644 --- a/build/integration/features/dav-v2.feature +++ b/build/integration/features/dav-v2.feature @@ -77,6 +77,7 @@ Feature: dav-v2 | shareType | 0 | | permissions | 31 | | shareWith | user0 | + And user "user0" accepts last share And As an "user0" When User "user0" uploads file "data/textfile.txt" to "/testquota/asdf.txt" Then the HTTP status code should be "201" diff --git a/build/integration/features/external-storage.feature b/build/integration/features/external-storage.feature index 09ffdb29803..e1e9ff8860b 100644 --- a/build/integration/features/external-storage.feature +++ b/build/integration/features/external-storage.feature @@ -12,6 +12,7 @@ Feature: external-storage And User "user0" moved file "/textfile0.txt" to "/local_storage/foo/textfile0.txt" And folder "/local_storage/foo" of user "user0" is shared with user "user1" And As an "user1" + And accepting last share When creating a share with | path | foo | | shareType | 3 | diff --git a/build/integration/features/favorites.feature b/build/integration/features/favorites.feature index a6c5c9fda95..0439ada9d60 100644 --- a/build/integration/features/favorites.feature +++ b/build/integration/features/favorites.feature @@ -142,6 +142,7 @@ Feature: favorite And user "user0" created a folder "/shared" And User "user0" moved file "/textfile0.txt" to "/shared/shared_file.txt" And folder "/shared" of user "user0" is shared with user "user1" + And user "user1" accepts last share And user "user1" favorites element "/shared/shared_file.txt" When User "user1" moved file "/shared/shared_file.txt" to "/taken_out.txt" Then user "user1" in folder "/" should have favorited the following elements diff --git a/build/integration/features/tags.feature b/build/integration/features/tags.feature index 96e06bd5e4b..495008ffdd2 100644 --- a/build/integration/features/tags.feature +++ b/build/integration/features/tags.feature @@ -121,6 +121,7 @@ Feature: tags | path | myFileToTag.txt | | shareWith | 12345 | | shareType | 0 | + Given user "12345" accepts last share When "12345" adds the tag "MySuperAwesomeTagName" to "/myFileToTag.txt" shared by "user0" Then The response should have a status code "201" And "/myFileToTag.txt" shared by "user0" has the following tags @@ -148,6 +149,7 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share When "user0" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" When "user1" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" Then The response should have a status code "403" @@ -165,6 +167,7 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share When "user1" adds the tag "MySuperAwesomeTagName" to "/myFileToTag.txt" shared by "user0" Then The response should have a status code "201" And "/myFileToTag.txt" shared by "user0" has the following tags @@ -181,6 +184,7 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share When "user0" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" When "user1" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" Then The response should have a status code "412" @@ -196,6 +200,7 @@ Feature: tags | path | myFileToTag.txt | | shareWith | admin | | shareType | 0 | + Given user "admin" accepts last share When "user0" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" When "admin" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" Then The response should have a status code "201" @@ -214,6 +219,7 @@ Feature: tags | path | myFileToTag.txt | | shareWith | admin | | shareType | 0 | + Given user "admin" accepts last share When "user0" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" When "admin" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" Then The response should have a status code "201" @@ -234,6 +240,7 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share Given "user0" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" Given "user0" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" When "user1" removes the tag "MyFirstTag" from "/myFileToTag.txt" shared by "user0" @@ -265,10 +272,12 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share Given as "user0" creating a share with | path | myFileToTag.txt | | shareWith | admin | | shareType | 0 | + Given user "admin" accepts last share Given "admin" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" Given "user0" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" When "user1" removes the tag "MyFirstTag" from "/myFileToTag.txt" shared by "user0" @@ -289,10 +298,12 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share Given as "user0" creating a share with | path | myFileToTag.txt | | shareWith | admin | | shareType | 0 | + Given user "admin" accepts last share Given "admin" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" Given "user0" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" When "admin" removes the tag "MyFirstTag" from "/myFileToTag.txt" shared by "user0" @@ -312,10 +323,12 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share Given as "user0" creating a share with | path | myFileToTag.txt | | shareWith | admin | | shareType | 0 | + Given user "admin" accepts last share Given "admin" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" Given "user0" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" Given As "user0" remove all shares from the file named "/myFileToTag.txt" @@ -332,10 +345,12 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share Given as "user0" creating a share with | path | myFileToTag.txt | | shareWith | admin | | shareType | 0 | + Given user "admin" accepts last share Given "admin" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" Given "user0" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" When "user1" removes the tag "MyFirstTag" from "/myFileToTag.txt" shared by "user0" @@ -357,10 +372,12 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share Given as "user0" creating a share with | path | myFileToTag.txt | | shareWith | admin | | shareType | 0 | + Given user "admin" accepts last share Given "admin" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" Given "user0" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" When "admin" removes the tag "MyFirstTag" from "/myFileToTag.txt" shared by "user0" @@ -380,10 +397,12 @@ Feature: tags | path | myFileToTag.txt | | shareWith | user1 | | shareType | 0 | + Given user "user1" accepts last share Given as "user0" creating a share with | path | myFileToTag.txt | | shareWith | admin | | shareType | 0 | + Given user "admin" accepts last share Given "admin" adds the tag "MyFirstTag" to "/myFileToTag.txt" shared by "user0" Given "user0" adds the tag "MySecondTag" to "/myFileToTag.txt" shared by "user0" Given As "user0" remove all shares from the file named "/myFileToTag.txt" diff --git a/build/integration/features/transfer-ownership.feature b/build/integration/features/transfer-ownership.feature index 3f10fa75a83..a0959db6c17 100644 --- a/build/integration/features/transfer-ownership.feature +++ b/build/integration/features/transfer-ownership.feature @@ -27,6 +27,7 @@ Feature: transfer-ownership And user "user2" exists And User "user0" uploads file "data/textfile.txt" to "/somefile.txt" And file "/somefile.txt" of user "user0" is shared with user "user2" with permissions 19 + And user "user2" accepts last share When transfering ownership from "user0" to "user1" And the command was successful And As an "user2" @@ -39,6 +40,7 @@ Feature: transfer-ownership And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with user "user2" with permissions 31 + And user "user2" accepts last share When transfering ownership from "user0" to "user1" And the command was successful And As an "user2" @@ -50,6 +52,7 @@ Feature: transfer-ownership And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with user "user1" with permissions 31 + And user "user1" accepts last share When transfering ownership from "user0" to "user1" And the command was successful And As an "user1" @@ -66,7 +69,9 @@ Feature: transfer-ownership And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with group "group1" with permissions 31 + And user "user2" accepts last share And folder "/test" of user "user0" is shared with user "user2" with permissions 31 + And user "user2" accepts last share When transfering ownership from "user0" to "user1" And the command was successful And As an "user2" @@ -80,6 +85,7 @@ Feature: transfer-ownership And user "user2" belongs to group "test" And User "user0" uploads file "data/textfile.txt" to "/somefile.txt" And file "/somefile.txt" of user "user0" is shared with group "test" + And user "user2" accepts last share When transfering ownership from "user0" to "test" And the command was successful And As an "user2" @@ -91,6 +97,7 @@ Feature: transfer-ownership And user "user2" exists And User "user2" created a folder "/test" And folder "/test" of user "user2" is shared with user "user0" with permissions 31 + And user "user0" accepts last share When transfering ownership from "user0" to "user1" And the command was successful And As an "user1" @@ -114,6 +121,7 @@ Feature: transfer-ownership And User "user0" created a folder "/sub" And User "user0" created a folder "/sub/test" And folder "/sub/test" of user "user0" is shared with user "user2" with permissions 31 + And user "user2" accepts last share And User "user0" deletes folder "/sub" When transfering ownership from "user0" to "user1" Then the command was successful @@ -148,6 +156,7 @@ Feature: transfer-ownership And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And file "/test/somefile.txt" of user "user0" is shared with user "user2" with permissions 19 + And user "user2" accepts last share When transfering ownership of path "test" from "user0" to "user1" And the command was successful And As an "user2" @@ -160,6 +169,7 @@ Feature: transfer-ownership And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with user "user2" with permissions 31 + And user "user2" accepts last share When transfering ownership of path "test" from "user0" to "user1" And the command was successful And As an "user2" @@ -171,6 +181,7 @@ Feature: transfer-ownership And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with user "user1" with permissions 31 + And user "user1" accepts last share When transfering ownership of path "test" from "user0" to "user1" And the command was successful And As an "user1" @@ -187,7 +198,9 @@ Feature: transfer-ownership And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with group "group1" with permissions 31 + And user "user2" accepts last share And folder "/test" of user "user0" is shared with user "user2" with permissions 31 + And user "user2" accepts last share When transfering ownership of path "test" from "user0" to "user1" And the command was successful And As an "user2" @@ -200,6 +213,7 @@ Feature: transfer-ownership And User "user2" created a folder "/test" And User "user0" created a folder "/sub" And folder "/test" of user "user2" is shared with user "user0" with permissions 31 + And user "user0" accepts last share And User "user0" moved folder "/test" to "/sub/test" When transfering ownership of path "sub" from "user0" to "user1" And the command was successful diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index a5fd8140518..3a488775a22 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -48,6 +48,7 @@ Feature: webdav-related | shareType | 0 | | permissions | 1 | | shareWith | user0 | + And user "user0" accepts last share And As an "user0" And User "user0" moves file "/textfile0.txt" to "/testshare/textfile0.txt" And the HTTP status code should be "403" @@ -66,6 +67,7 @@ Feature: webdav-related | shareType | 0 | | permissions | 1 | | shareWith | user0 | + And user "user0" accepts last share And User "user1" copies file "/welcome.txt" to "/testshare/overwritethis.txt" And As an "user0" When User "user0" moves file "/textfile0.txt" to "/testshare/overwritethis.txt" @@ -102,6 +104,7 @@ Feature: webdav-related | shareType | 0 | | permissions | 1 | | shareWith | user0 | + And user "user0" accepts last share And As an "user0" When User "user0" copies file "/textfile0.txt" to "/testshare/textfile0.txt" Then the HTTP status code should be "403" @@ -120,6 +123,7 @@ Feature: webdav-related | shareType | 0 | | permissions | 1 | | shareWith | user0 | + And user "user0" accepts last share And User "user1" copies file "/welcome.txt" to "/testshare/overwritethis.txt" And As an "user0" When User "user0" copies file "/textfile0.txt" to "/testshare/overwritethis.txt" @@ -172,6 +176,7 @@ Feature: webdav-related | shareType | 0 | | permissions | 31 | | shareWith | user0 | + And user "user0" accepts last share Then as "user0" gets properties of folder "/testquota" with |{DAV:}quota-available-bytes| And the single response should contain a property "{DAV:}quota-available-bytes" with value "10485421" @@ -190,6 +195,7 @@ Feature: webdav-related | shareType | 0 | | permissions | 31 | | shareWith | user0 | + And user "user0" accepts last share And As an "user0" When User "user0" uploads file "data/textfile.txt" to "/testquota/asdf.txt" Then the HTTP status code should be "201" @@ -212,6 +218,7 @@ Feature: webdav-related And user "user1" has a quota of "1 KB" And user "user0" adds a file of 93 bytes to "/user0.txt" And file "user0.txt" of user "user0" is shared with user "user1" + And user "user1" accepts last share When as "user1" gets properties of folder "/" with |{DAV:}quota-available-bytes| Then the single response should contain a property "{DAV:}quota-available-bytes" with value "685" @@ -425,6 +432,7 @@ Feature: webdav-related | shareType | 0 | | permissions | 31 | | shareWith | user0 | + And user "user0" accepts last share And User "user0" uploads file with content "copytest" to "/copytest.txt" When User "user0" copies file "/copytest.txt" to "/testcopypermissionsAllowed/copytest.txt" Then the HTTP status code should be "201" @@ -440,6 +448,7 @@ Feature: webdav-related | shareType | 0 | | permissions | 1 | | shareWith | user0 | + And user "user0" accepts last share And User "user0" uploads file with content "copytest" to "/copytest.txt" When User "user0" copies file "/copytest.txt" to "/testcopypermissionsNotAllowed/copytest.txt" Then the HTTP status code should be "403" @@ -458,6 +467,7 @@ Feature: webdav-related | shareType | 0 | | permissions | 23 | | shareWith | user0 | + And user "user0" accepts last share And As an "user0" And User "user0" uploads file "data/textfile.txt" to "/testfolder/asdf.txt" And As an "user1" |