Files
ocis/tests/parallelDeployAcceptance/features/apiWebdavOperations/downloadFile.feature
T

145 lines
6.3 KiB
Gherkin
Raw Normal View History

2021-11-19 12:59:30 +05:45
Feature: download file
As a user
I want to be able to download files
2022-05-03 18:55:28 +00:00
So that I can work with local copies of files on my client system
2021-11-19 12:59:30 +05:45
Background:
Given using "oc10" as owncloud selector
And user "Alice" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt"
Scenario Outline: download a file
Given using "ocis" as owncloud selector
2023-07-12 12:42:32 +05:45
And using <dav-path-version> DAV path
2021-11-19 12:59:30 +05:45
When user "Alice" downloads file "textfile.txt" using the WebDAV API
Then the downloaded content should be "ownCloud test text file"
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
2021-11-19 12:59:30 +05:45
Scenario Outline: download a file with range
Given using "ocis" as owncloud selector
2023-07-12 12:42:32 +05:45
And using <dav-path-version> DAV path
2021-11-19 12:59:30 +05:45
When user "Alice" downloads file "textfile.txt" with range "bytes=0-7" using the WebDAV API
Then the downloaded content should be "ownCloud"
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
2021-11-19 12:59:30 +05:45
Scenario: Get the size of a file
Given using "ocis" as owncloud selector
When user "Alice" gets the size of file "textfile.txt" using the WebDAV API
Then the HTTP status code should be "207"
And the size of the file should be "23"
Scenario Outline: Download a file with comma in the filename
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2021-11-19 12:59:30 +05:45
And user "Alice" has uploaded file with content "file with comma in filename" to <filename>
And using "ocis" as owncloud selector
When user "Alice" downloads file <filename> using the WebDAV API
Then the downloaded content should be "file with comma in filename"
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version | filename |
| old | "sample,1.txt" |
| old | ",,,.txt" |
| old | ",,,.," |
| new | "sample,1.txt" |
| new | ",,,.txt" |
| new | ",,,.," |
2021-11-19 12:59:30 +05:45
Scenario Outline: download a file with single part ranges
Given using "ocis" as owncloud selector
2023-07-12 12:42:32 +05:45
And using <dav-path-version> DAV path
2021-11-19 12:59:30 +05:45
When user "Alice" downloads file "textfile.txt" with range "bytes=0-7" using the WebDAV API
Then the HTTP status code should be "206"
And the following headers should be set
2023-07-12 12:42:32 +05:45
| header | value |
| Content-Length | 8 |
| Content-Range | bytes 0-7/23 |
2021-11-19 12:59:30 +05:45
And the downloaded content should be "ownCloud"
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
2021-11-19 12:59:30 +05:45
Scenario Outline: download a file with last byte range out of bounds
Given using "ocis" as owncloud selector
2023-07-12 12:42:32 +05:45
And using <dav-path-version> DAV path
2021-11-19 12:59:30 +05:45
When user "Alice" downloads file "textfile.txt" with range "bytes=0-24" using the WebDAV API
Then the HTTP status code should be "206"
And the downloaded content should be "ownCloud test text file"
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
2021-11-19 12:59:30 +05:45
Scenario Outline: download a range at the end of a file
Given using "ocis" as owncloud selector
2023-07-12 12:42:32 +05:45
And using <dav-path-version> DAV path
2021-11-19 12:59:30 +05:45
When user "Alice" downloads file "textfile.txt" with range "bytes=-4" using the WebDAV API
Then the HTTP status code should be "206"
And the downloaded content should be "file"
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
2021-11-19 12:59:30 +05:45
Scenario Outline: download a file with range out of bounds
Given using "ocis" as owncloud selector
2023-07-12 12:42:32 +05:45
And using <dav-path-version> DAV path
2021-11-19 12:59:30 +05:45
When user "Alice" downloads file "textfile.txt" with range "bytes=24-30" using the WebDAV API
Then the HTTP status code should be "416"
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
2021-11-19 12:59:30 +05:45
Scenario Outline: download a hidden file
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2021-11-19 12:59:30 +05:45
And user "Alice" has created folder "FOLDER"
And user "Alice" has uploaded the following files with content "hidden file"
| path |
| .hidden_file |
| FOLDER/.hidden_file |
And using "ocis" as owncloud selector
When user "Alice" downloads file ".hidden_file" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded content should be "hidden file"
When user "Alice" downloads file "FOLDER/.hidden_file" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded content should be "hidden file"
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
2021-11-19 12:59:30 +05:45
Scenario Outline: Downloading a file should serve security headers
Given using "ocis" as owncloud selector
2023-07-12 12:42:32 +05:45
And using <dav-path-version> DAV path
2021-11-19 12:59:30 +05:45
When user "Alice" downloads file "textfile.txt" using the WebDAV API
Then the following headers should be set
2023-07-12 12:42:32 +05:45
| header | value |
2021-11-19 12:59:30 +05:45
| Content-Disposition | attachment; filename*=UTF-8''textfile.txt; filename="textfile.txt" |
| Content-Security-Policy | child-src 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; frame-ancestors 'self'; frame-src 'self' blob: https://embed.diagrams.net/; img-src 'self' data: blob:; manifest-src 'self'; media-src 'self'; object-src 'self' blob:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' |
2021-11-19 12:59:30 +05:45
| X-Content-Type-Options | nosniff |
| X-Download-Options | noopen |
| X-Frame-Options | SAMEORIGIN |
| X-Permitted-Cross-Domain-Policies | none |
| X-Robots-Tag | none |
| X-XSS-Protection | 1; mode=block |
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |