From bcb8a1d0e8b505df58af7a27202d2fbe9bc8b0d9 Mon Sep 17 00:00:00 2001 From: swoichha Date: Mon, 21 Dec 2020 17:43:45 +0545 Subject: [PATCH] added tests for file version and upload to share --- .../uploadToShare.feature | 21 ++++++++++++++++++- .../updateShare.feature | 20 ++++++++++++++++++ .../features/apiVersions/fileVersions.feature | 2 +- .../fileVersionsSharingToShares.feature | 13 +++++++++++- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/features/apiShareOperationsToShares/uploadToShare.feature b/tests/acceptance/features/apiShareOperationsToShares/uploadToShare.feature index cb4b495ceb11..b22fc2b0bbe5 100644 --- a/tests/acceptance/features/apiShareOperationsToShares/uploadToShare.feature +++ b/tests/acceptance/features/apiShareOperationsToShares/uploadToShare.feature @@ -22,7 +22,7 @@ Feature: sharing Scenario Outline: Uploading file to a group read-only share folder does not work Given using DAV path - Given user "Brian" has been created with default attributes and skeleton files + And user "Brian" has been created with default attributes and skeleton files And group "grp1" has been created And user "Brian" has been added to group "grp1" And user "Alice" has created a share with settings @@ -259,3 +259,22 @@ Feature: sharing | 2 | welt | Then the HTTP status code should be "403" And as "Alice" file "/FOLDER/myfile.txt" should not exist + + + Scenario Outline: Sharer can download file uploaded with different permission by sharee to a shared folder + Given using DAV path + And user "Brian" has been created with default attributes and skeleton files + And user "Alice" has created a share with settings + | path | FOLDER | + | shareType | user | + | permissions | | + | shareWith | Brian | + And user "Brian" has accepted share "/FOLDER" offered by user "Alice" + When user "Brian" uploads file with content "some content" to "/Shares/FOLDER/textFile.txt" using the WebDAV API + And user "Alice" downloads file "/FOLDER/textFile.txt" using the WebDAV API + Then the HTTP status code should be "200" + And the downloaded content should be "some content" + Examples: + | dav-path | permissions | + | old | change | + | new | create | diff --git a/tests/acceptance/features/apiShareUpdateToShares/updateShare.feature b/tests/acceptance/features/apiShareUpdateToShares/updateShare.feature index 75f8275e1aeb..cd18cca5cae7 100644 --- a/tests/acceptance/features/apiShareUpdateToShares/updateShare.feature +++ b/tests/acceptance/features/apiShareUpdateToShares/updateShare.feature @@ -363,3 +363,23 @@ Feature: sharing | ocs_api_version | http_status_code | | 1 | 200 | | 2 | 404 | + + + Scenario Outline: Sharer deletes file uploaded with upload-only permission by sharee to a shared folder + Given using DAV path + And user "Brian" has been created with default attributes and without skeleton files + And user "Alice" has created a share with settings + | path | FOLDER | + | shareType | user | + | permissions | create | + | shareWith | Brian | + And user "Brian" has accepted share "/FOLDER" offered by user "Alice" + And user "Brian" has uploaded file with content "some content" to "/Shares/FOLDER/textFile.txt" + When user "Alice" deletes file "/FOLDER/textFile.txt" using the WebDAV API + Then the HTTP status code should be "204" + And as "Brian" file "/Shares/FOLDER/textFile.txt" should not exist + And as "Alice" file "/textFile.txt" should not exist + Examples: + | dav-path | + | old | + | new | diff --git a/tests/acceptance/features/apiVersions/fileVersions.feature b/tests/acceptance/features/apiVersions/fileVersions.feature index 413694e820d1..2ffb12d696ff 100644 --- a/tests/acceptance/features/apiVersions/fileVersions.feature +++ b/tests/acceptance/features/apiVersions/fileVersions.feature @@ -389,4 +389,4 @@ Feature: dav-versions Scenario: User cannot access meta folder of a file with invalid fileid Given user "Brian" has been created with default attributes and without skeleton files When user "Brian" sends HTTP method "PROPFIND" to URL "/remote.php/dav/meta/MTI4NGQyMzgtYWEMi00MmNlLWJkxzQtMGIwMDAwMsA5MTU2OjhjY2QyNzUxLTkwYTQtNDBmMi1iOWYzLTYxZWRmODQ0MjFmNA==/v" - Then the HTTP status code should be "404" \ No newline at end of file + Then the HTTP status code should be "404" diff --git a/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature b/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature index 037c62ee8c79..9598c88a0121 100644 --- a/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature +++ b/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature @@ -285,4 +285,15 @@ Feature: dav-versions And user "Alice" has shared file "textfile0.txt" with user "Brian" When user "Brian" tries to get versions of file "textfile0.txt" from "Alice" Then the HTTP status code should be "404" - And the value of the item "//s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\NotFound" \ No newline at end of file + And the value of the item "//s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\NotFound" + + + Scenario: sharer tries get file versions of shared file when the sharee changes the content of the file + Given user "Brian" has been created with default attributes and without skeleton files + And user "Alice" has uploaded file with content "First content" to "sharefile.txt" + And user "Alice" has shared file "sharefile.txt" with user "Brian" + And user "Brian" has accepted share "/sharefile.txt" offered by user "Alice" + When user "Brian" has uploaded file with content "Second content" to "/Shares/sharefile.txt" + Then the HTTP status code should be "204" + And the version folder of file "/Shares/sharefile.txt" for user "Brian" should contain "1" element + And the version folder of file "/sharefile.txt" for user "Alice" should contain "1" element