-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[tests-only] test webdav previews #37166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+240
−5
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9abff5b
test webdav previews
individual-it 39c0011
more tests
individual-it 6f02979
added more tests
swoichha 3fec16a
added test scenarios for disable previews and set maximum size of pre…
swoichha 762c15b
made changes in WebDav and WebDavHelper to pass special character in …
swoichha 9afe681
few scenario title changed
swoichha d3c0999
added issue tag
swoichha 0cc0426
added test to set/unset preview size and downloadPreviews method
swoichha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
tests/acceptance/features/apiWebdavPreviews/previews.feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,141 @@ | ||||||||||
| @api @TestAlsoOnExternalUserBackend | ||||||||||
| @skipOnOcis | ||||||||||
| Feature: previews of files downloaded through the webdav API | ||||||||||
|
|
||||||||||
| Background: | ||||||||||
| Given user "user0" has been created with default attributes and without skeleton files | ||||||||||
|
|
||||||||||
| Scenario Outline: download previews of different sizes | ||||||||||
| Given user "user0" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt" | ||||||||||
| When user "user0" downloads the preview of "/parent.txt" with width <width> and height <height> using the WebDAV API | ||||||||||
| Then the HTTP status code should be "200" | ||||||||||
| And the downloaded image should be <width> pixels wide and <height> pixels high | ||||||||||
| Examples: | ||||||||||
| | width | height | | ||||||||||
| | 1 | 1 | | ||||||||||
| | 32 | 32 | | ||||||||||
| | 1024 | 1024 | | ||||||||||
| | 1 | 1024 | | ||||||||||
| | 1024 | 1 | | ||||||||||
|
|
||||||||||
| Scenario Outline: download previews with invalid width | ||||||||||
| Given user "user0" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt" | ||||||||||
| When user "user0" downloads the preview of "/parent.txt" with width "<width>" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "400" | ||||||||||
| And the value of the item "/d:error/s:message" in the response should be "Cannot set width of 0 or smaller!" | ||||||||||
| And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\BadRequest" | ||||||||||
| Examples: | ||||||||||
| | width | | ||||||||||
| | 0 | | ||||||||||
| | 0.5 | | ||||||||||
| | -1 | | ||||||||||
| | false | | ||||||||||
| | true | | ||||||||||
| | A | | ||||||||||
| | %2F | | ||||||||||
|
|
||||||||||
| Scenario Outline: download previews with invalid height | ||||||||||
| Given user "user0" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt" | ||||||||||
| When user "user0" downloads the preview of "/parent.txt" with width "32" and height "<height>" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "400" | ||||||||||
| And the value of the item "/d:error/s:message" in the response should be "Cannot set height of 0 or smaller!" | ||||||||||
| And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\BadRequest" | ||||||||||
| Examples: | ||||||||||
| | height | | ||||||||||
| | 0 | | ||||||||||
| | 0.5 | | ||||||||||
| | -1 | | ||||||||||
| | false | | ||||||||||
| | true | | ||||||||||
| | A | | ||||||||||
| | %2F | | ||||||||||
|
|
||||||||||
| Scenario: download previews of files inside sub-folders | ||||||||||
| Given user "user0" has created folder "subfolder" | ||||||||||
| And user "user0" has uploaded file "filesForUpload/lorem.txt" to "/subfolder/parent.txt" | ||||||||||
| When user "user0" downloads the preview of "/subfolder/parent.txt" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "200" | ||||||||||
| And the downloaded image should be "32" pixels wide and "32" pixels high | ||||||||||
|
|
||||||||||
| Scenario Outline: download previews of file types that don't support preview | ||||||||||
| Given user "user0" has uploaded file "filesForUpload/<filename>" to "/<newfilename>" | ||||||||||
| When user "user0" downloads the preview of "/<newfilename>" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "404" | ||||||||||
| And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\NotFound" | ||||||||||
| Examples: | ||||||||||
| | filename | newfilename | | ||||||||||
| | simple.pdf | test.pdf | | ||||||||||
| | simple.odt | test.odt | | ||||||||||
| | new-data.zip | test.zip | | ||||||||||
|
|
||||||||||
| @issue-ocis-webdav-187 | ||||||||||
| Scenario Outline: download previews of different image file types | ||||||||||
| Given user "user0" has uploaded file "filesForUpload/<imageName>" to "/<newImageName>" | ||||||||||
| When user "user0" downloads the preview of "/<newImageName>" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "200" | ||||||||||
| And the downloaded image should be "32" pixels wide and "32" pixels high | ||||||||||
| Examples: | ||||||||||
| | imageName | newImageName | | ||||||||||
| | testavatar.jpg | testimage.jpg | | ||||||||||
| | testavatar.png | testimage.png | | ||||||||||
|
|
||||||||||
| @issue-ocis-webdav-187 | ||||||||||
| Scenario: download previews of image after renaming it | ||||||||||
| Given user "user0" has uploaded file "filesForUpload/testavatar.jpg" to "/testimage.jpg" | ||||||||||
| When user "user0" moves file "/testimage.jpg" to "/testimage.txt" using the WebDAV API | ||||||||||
| And user "user0" downloads the preview of "/testimage.txt" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "200" | ||||||||||
| And the downloaded image should be "32" pixels wide and "32" pixels high | ||||||||||
|
|
||||||||||
| Scenario: download previews of shared files | ||||||||||
| Given user "user1" has been created with default attributes and without skeleton files | ||||||||||
| And user "user0" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt" | ||||||||||
| And user "user0" has shared file "/parent.txt" with user "user1" | ||||||||||
| When user "user1" downloads the preview of "/parent.txt" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "200" | ||||||||||
| And the downloaded image should be "32" pixels wide and "32" pixels high | ||||||||||
|
|
||||||||||
| Scenario: download previews of other users files | ||||||||||
| Given user "user1" has been created with default attributes and without skeleton files | ||||||||||
| And user "user0" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt" | ||||||||||
| When user "user1" downloads the preview of "/parent.txt" of "user0" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "404" | ||||||||||
| And the value of the item "/d:error/s:message" in the response should be "File not found: parent.txt in 'user0'" | ||||||||||
| And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\NotFound" | ||||||||||
|
|
||||||||||
| Scenario: download previews of folders | ||||||||||
| Given user "user0" has created folder "subfolder" | ||||||||||
| When user "user0" downloads the preview of "/subfolder/" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "400" | ||||||||||
| And the value of the item "/d:error/s:message" in the response should be "Unsupported file type" | ||||||||||
| And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\BadRequest" | ||||||||||
|
|
||||||||||
| Scenario: download previews of not-existing files | ||||||||||
| When user "user0" downloads the preview of "/parent.txt" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "404" | ||||||||||
| And the value of the item "/d:error/s:message" in the response should be "File with name parent.txt could not be located" | ||||||||||
| And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\NotFound" | ||||||||||
|
|
||||||||||
| Scenario: Download file previews when it is disabled by the administrator | ||||||||||
| Given the administrator has updated system config key "enable_previews" with value "false" and type "boolean" | ||||||||||
| And user "user0" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt" | ||||||||||
| When user "user0" downloads the preview of "/parent.txt" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "404" | ||||||||||
| And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\NotFound" | ||||||||||
|
|
||||||||||
| Scenario: unset maximum size of previews | ||||||||||
| Given user "user0" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt" | ||||||||||
| And the administrator has updated system config key "preview_max_x" with value "null" | ||||||||||
|
phil-davis marked this conversation as resolved.
|
||||||||||
| And the administrator has updated system config key "preview_max_y" with value "null" | ||||||||||
| When user "user0" downloads the preview of "/parent.txt" with width "32" and height "32" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "404" | ||||||||||
| And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\NotFound" | ||||||||||
|
|
||||||||||
| Scenario: set maximum size of previews | ||||||||||
|
phil-davis marked this conversation as resolved.
|
||||||||||
| Given user "user0" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt" | ||||||||||
| When the administrator updates system config key "preview_max_x" with value "null" using the occ command | ||||||||||
| And the administrator updates system config key "preview_max_y" with value "null" using the occ command | ||||||||||
|
Comment on lines
+136
to
+137
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought that the test would be something like:
Suggested change
And then try to download a preview of size 64x64. And see what happens. |
||||||||||
| Then the HTTP status code should be "201" | ||||||||||
| When user "user0" downloads the preview of "/parent.txt" with width "null" and height "null" using the WebDAV API | ||||||||||
| Then the HTTP status code should be "400" | ||||||||||
| And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\BadRequest" | ||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.