Skip to content

Commit

Permalink
added tests for file version and upload to share
Browse files Browse the repository at this point in the history
  • Loading branch information
swoichha committed Dec 22, 2020
1 parent 957099b commit 9ee0918
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,39 @@ 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 read/write permission by sharee to a shared folder
Given using <dav-path> 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 | change |
| 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" downloads file "/FOLDER/textFile.txt" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded content should be "ownCloud test text file 0"
Examples:
| dav-path |
| old |
| new |

Scenario Outline: Sharer can download file uploaded with upload-only permission by sharee to a shared folder
Given using <dav-path> 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" 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 |
| old |
| new |
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,21 @@ 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> 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
Examples:
| dav-path |
| old |
| new |
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiVersions/fileVersions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Then the HTTP status code should be "404"
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,14 @@ 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"
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 "/testshare/testfile.txt" for user "Alice" should contain "1" elements

0 comments on commit 9ee0918

Please sign in to comment.