Skip to content

Commit

Permalink
Improved then step to suite apiWebdavMove2
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarGi committed Mar 4, 2022
1 parent 953209d commit d66b2ba
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 47 deletions.
47 changes: 37 additions & 10 deletions tests/acceptance/features/apiWebdavMove2/moveFile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ Feature: move (rename) file
| shareWith | Alice |
When user "Alice" moves file "/textfile0.txt" to "/testshare/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "403"
When user "Alice" downloads file "/testshare/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "404"
And user "Alice" should not be able to download file "/testshare/textfile0.txt"
Examples:
| dav_version |
| old |
Expand Down Expand Up @@ -257,7 +256,7 @@ Feature: move (rename) file
And user "Brian" has stored id of folder "/folderA/ONE"
And user "Brian" has created folder "/folderA/ONE/TWO"
When user "Brian" moves folder "/folderA/ONE" to "/folderB/ONE" using the WebDAV API
# Then the HTTP status code should be "201"
Then the HTTP status code should be "201"
And as "Brian" folder "/folderA" should exist
And as "Brian" folder "/folderA/ONE" should not exist
# yes, a weird bug used to make this one fail
Expand Down Expand Up @@ -343,8 +342,8 @@ Feature: move (rename) file
Scenario Outline: renaming file with dots in the path
Given using <dav_version> DAV path
And user "Alice" has created folder "<folder_name>"
When user "Alice" uploads file with content "uploaded content for file name ending with a dot" to "<folder_name>/<file_name>" using the WebDAV API
And user "Alice" moves file "<folder_name>/<file_name>" to "<folder_name>/abc.txt" using the WebDAV API
And user "Alice" has uploaded file with content "uploaded content for file name ending with a dot" to "<folder_name>/<file_name>"
When user "Alice" moves file "<folder_name>/<file_name>" to "<folder_name>/abc.txt" using the WebDAV API
Then the HTTP status code should be "201"
And as "Alice" file "<folder_name>/abc.txt" should exist
Examples:
Expand Down Expand Up @@ -422,6 +421,10 @@ Feature: move (rename) file
| path |
| .hidden_file102 |
| /FOLDER/.hidden_file101 |
And the content of the following files for user "Alice" should be "hidden file"
| path |
| .hidden_file102 |
| /FOLDER/.hidden_file101 |
Examples:
| dav_version |
| old |
Expand All @@ -448,6 +451,10 @@ Feature: move (rename) file
| path |
| .hidden_file102 |
| hidden_file102.txt |
And the content of the following files for user "Alice" should be "hidden file"
| path |
| .hidden_file102 |
| hidden_file102.txt |
Examples:
| dav_version |
| old |
Expand Down Expand Up @@ -536,18 +543,38 @@ Feature: move (rename) file
| spaces | texta | file.txt | 0 |


Scenario: move a file of size zero byte
Given user "Alice" has uploaded file "filesForUpload/zerobyte.txt" to "/zerobyte.txt"
Scenario Outline: move a file of size zero byte
Given using <dav_version> DAV path
And user "Alice" has uploaded file "filesForUpload/zerobyte.txt" to "/zerobyte.txt"
And user "Alice" has created folder "/testZeroByte"
When user "Alice" moves file "/zerobyte.txt" to "/testZeroByte/zerobyte.txt" using the WebDAV API
Then the HTTP status code should be "201"
And as "Alice" file "/testZeroByte/zerobyte.txt" should exist
And as "Alice" file "/zerobyte.txt" should not exist
Examples:
| dav_version |
| old |
| new |

@skipOnOcV10 @personalSpace
Examples:
| dav_version |
| spaces |


Scenario: rename a file of size zero byte
Given user "Alice" has uploaded file "filesForUpload/zerobyte.txt" to "/zerobyte.txt"
Scenario Outline: rename a file of size zero byte
Given using <dav_version> DAV path
And user "Alice" has uploaded file "filesForUpload/zerobyte.txt" to "/zerobyte.txt"
When user "Alice" moves file "/zerobyte.txt" to "/rename_zerobyte.txt" using the WebDAV API
Then the HTTP status code should be "201"
And as "Alice" file "/rename_zerobyte.txt" should exist
And as "Alice" file "/zerobyte.txt" should not exist
And as "Alice" file "/zerobyte.txt" should not exist
Examples:
| dav_version |
| old |
| new |

@skipOnOcV10 @personalSpace
Examples:
| dav_version |
| spaces |
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Feature: users cannot move (rename) a file to a blacklisted name

Scenario Outline: rename a file to a banned filename
Given using <dav_version> DAV path
When the administrator updates system config key "blacklisted_files" with value '["blacklisted-file.txt",".htaccess"]' and type "json" using the occ command
And user "Alice" moves file "/textfile0.txt" to "/blacklisted-file.txt" using the WebDAV API
And the administrator has updated system config key "blacklisted_files" with value '["blacklisted-file.txt",".htaccess"]' and type "json"
When user "Alice" moves file "/textfile0.txt" to "/blacklisted-file.txt" using the WebDAV API
Then the HTTP status code should be "403"
Examples:
| dav_version |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Feature: users cannot move (rename) a file to or into an excluded directory

Scenario Outline: rename a file to an excluded directory name
Given using <dav_version> DAV path
When the administrator updates system config key "excluded_directories" with value '[".github"]' and type "json" using the occ command
And user "Alice" moves file "/textfile0.txt" to "/.github" using the WebDAV API
And the administrator has updated system config key "excluded_directories" with value '[".github"]' and type "json"
When user "Alice" moves file "/textfile0.txt" to "/.github" using the WebDAV API
Then the HTTP status code should be "403"
Examples:
| dav_version |
Expand All @@ -29,8 +29,8 @@ Feature: users cannot move (rename) a file to or into an excluded directory
Scenario Outline: rename a file to an excluded directory name inside a parent directory
Given using <dav_version> DAV path
And user "Alice" has created folder "FOLDER"
When the administrator updates system config key "excluded_directories" with value '[".github"]' and type "json" using the occ command
And user "Alice" moves file "/textfile0.txt" to "/FOLDER/.github" using the WebDAV API
And the administrator has updated system config key "excluded_directories" with value '[".github"]' and type "json"
When user "Alice" moves file "/textfile0.txt" to "/FOLDER/.github" using the WebDAV API
Then the HTTP status code should be "403"
Examples:
| dav_version |
Expand Down
66 changes: 35 additions & 31 deletions tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ Feature: move (rename) file
| permissions | change |
| shareWith | Alice |
And user "<mover>" has uploaded file with content "test data" to "/testfile.txt"
When user "Alice" accepts share "/testshare" offered by user "Brian" using the sharing API
And user "<mover>" moves file "/testfile.txt" to "<destination_folder>/testfile.txt" using the WebDAV API
And user "Alice" has accepted share "/testshare" offered by user "Brian"
When user "<mover>" moves file "/testfile.txt" to "<destination_folder>/testfile.txt" using the WebDAV API
Then the HTTP status code should be "201"
And the content of file "/Shares/testshare/testfile.txt" for user "Alice" should be "test data"
And the content of file "/testshare/testfile.txt" for user "Brian" should be "test data"
And as "<mover>" file "/testfile.txt" should not exist
Examples:
| dav_version | mover | destination_folder |
| old | Alice | /Shares/testshare |
| new | Alice | /Shares/testshare |
| old | Brian | /testshare |
| new | Alice | /Shares/testshare |
| new | Brian | /testshare |

@personalSpace
Expand All @@ -49,17 +49,17 @@ Feature: move (rename) file
| shareType | user |
| permissions | change |
| shareWith | Alice |
When user "Alice" accepts share "/testshare" offered by user "Brian" using the sharing API
And user "<mover>" moves file "<source_folder>/testfile.txt" to "/testfile.txt" using the WebDAV API
And user "Alice" has accepted share "/testshare" offered by user "Brian"
When user "<mover>" moves file "<source_folder>/testfile.txt" to "/testfile.txt" using the WebDAV API
Then the HTTP status code should be "201"
And the content of file "/testfile.txt" for user "<mover>" should be "test data"
And as "Alice" file "/Shares/testfile.txt" should not exist
And as "Brian" file "/testshare/testfile.txt" should not exist
Examples:
| dav_version | mover | source_folder |
| old | Alice | /Shares/testshare |
| new | Alice | /Shares/testshare |
| old | Brian | /testshare |
| new | Alice | /Shares/testshare |
| new | Brian | /testshare |

@personalSpace
Expand All @@ -80,17 +80,17 @@ Feature: move (rename) file
| shareWith | Alice |
And user "<mover>" has created folder "/testsubfolder"
And user "<mover>" has uploaded file with content "test data" to "/testsubfolder/testfile.txt"
When user "Alice" accepts share "/testshare" offered by user "Brian" using the sharing API
And user "<mover>" moves folder "/testsubfolder" to "<destination_folder>/testsubfolder" using the WebDAV API
And user "Alice" has accepted share "/testshare" offered by user "Brian"
When user "<mover>" moves folder "/testsubfolder" to "<destination_folder>/testsubfolder" using the WebDAV API
Then the HTTP status code should be "201"
And the content of file "/Shares/testshare/testsubfolder/testfile.txt" for user "Alice" should be "test data"
And the content of file "/testshare/testsubfolder/testfile.txt" for user "Brian" should be "test data"
And as "<mover>" file "/testsubfolder" should not exist
Examples:
| dav_version | mover | destination_folder |
| old | Alice | /Shares/testshare |
| new | Alice | /Shares/testshare |
| old | Brian | /testshare |
| new | Alice | /Shares/testshare |
| new | Brian | /testshare |

@personalSpace
Expand All @@ -103,25 +103,27 @@ Feature: move (rename) file
Scenario Outline: Moving a folder out of a shared folder as the sharee and as the sharer
Given using <dav_version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Brian" has created folder "/testshare"
And user "Brian" has created folder "/testshare/testsubfolder"
And user "Brian" has created the following folders
| path |
| /testshare |
| /testshare/testsubfolder |
And user "Brian" has uploaded file with content "test data" to "/testshare/testsubfolder/testfile.txt"
And user "Brian" has created a share with settings
| path | testshare |
| shareType | user |
| permissions | change |
| shareWith | Alice |
When user "Alice" accepts share "/testshare" offered by user "Brian" using the sharing API
And user "<mover>" moves folder "<source_folder>/testsubfolder" to "/testsubfolder" using the WebDAV API
And user "Alice" has accepted share "/testshare" offered by user "Brian"
When user "<mover>" moves folder "<source_folder>/testsubfolder" to "/testsubfolder" using the WebDAV API
Then the HTTP status code should be "201"
And the content of file "/testsubfolder/testfile.txt" for user "<mover>" should be "test data"
And as "Alice" folder "<source_folder>/testsubfolder" should not exist
And as "Brian" folder "/testshare/testsubfolder" should not exist
Examples:
| dav_version | mover | source_folder |
| old | Alice | /Shares/testshare |
| new | Alice | /Shares/testshare |
| old | Brian | /testshare |
| new | Alice | /Shares/testshare |
| new | Brian | /testshare |

@personalSpace
Expand All @@ -141,11 +143,10 @@ Feature: move (rename) file
| shareType | user |
| permissions | read |
| shareWith | Alice |
When user "Alice" accepts share "/testshare" offered by user "Brian" using the sharing API
And user "Alice" moves file "/textfile0.txt" to "/Shares/testshare/textfile0.txt" using the WebDAV API
And user "Alice" has accepted share "/testshare" offered by user "Brian"
When user "Alice" moves file "/textfile0.txt" to "/Shares/testshare/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "403"
When user "Alice" downloads file "/Shares/testshare/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "404"
And user "Alice" should not be able to download file "/Shares/testshare/textfile0.txt"
Examples:
| dav_version |
| old |
Expand All @@ -169,8 +170,8 @@ Feature: move (rename) file
| permissions | read |
| shareWith | Alice |
And user "Brian" has copied file "/fileToCopy.txt" to "/testshare/overwritethis.txt"
When user "Alice" accepts share "/testshare" offered by user "Brian" using the sharing API
And user "Alice" moves file "/textfile0.txt" to "/Shares/testshare/overwritethis.txt" using the WebDAV API
And user "Alice" has accepted share "/testshare" offered by user "Brian"
When user "Alice" moves file "/textfile0.txt" to "/Shares/testshare/overwritethis.txt" using the WebDAV API
Then the HTTP status code should be "403"
And the content of file "/Shares/testshare/overwritethis.txt" for user "Alice" should be "Welcome to ownCloud"
Examples:
Expand All @@ -187,19 +188,22 @@ Feature: move (rename) file
Scenario Outline: Checking file id after a move between received shares
Given using <dav_version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has created folder "/folderA"
And user "Alice" has created folder "/folderB"
And user "Alice" has created the following folders
| path |
| /folderA |
| /folderB |
And user "Alice" has shared folder "/folderA" with user "Brian"
And user "Alice" has shared folder "/folderB" with user "Brian"
When user "Brian" accepts the following shares offered by user "Alice" using the sharing API
| path |
| /folderA |
| /folderB |
And user "Brian" creates folder "/Shares/folderA/ONE" using the WebDAV API
And user "Brian" stores id of folder "/Shares/folderA/ONE"
And user "Brian" creates folder "/Shares/folderA/ONE/TWO" using the WebDAV API
And user "Brian" moves folder "/Shares/folderA/ONE" to "/Shares/folderB/ONE" using the WebDAV API
Then as "Brian" folder "/Shares/folderA" should exist
And user "Brian" has accepted share "/folderA" offered by user "Alice"
And user "Brian" has accepted share "/folderB" offered by user "Alice"
And user "Brian" has created the following folders
| path |
| /Shares/folderA/ONE |
| /Shares/folderA/ONE/TWO |
And user "Brian" has stored id of folder "/Shares/folderA/ONE"
When user "Brian" moves folder "/Shares/folderA/ONE" to "/Shares/folderB/ONE" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "/Shares/folderA" should exist
And as "Brian" folder "/Shares/folderA/ONE" should not exist
And as "Brian" folder "/Shares/folderA/ONE/TWO" should not exist
And as "Brian" folder "/Shares/folderB/ONE" should exist
Expand Down

0 comments on commit d66b2ba

Please sign in to comment.