Skip to content
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

[tests-only] Tus tests for uploading to shared files with checksums #38484

Merged
merged 2 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Feature: checksums
| old |
| new |


Scenario Outline: Uploading a file with incorrect checksum should not work
Given using <dav_version> DAV path
And user "Alice" has created a new TUS resource on the WebDAV API with these headers:
Expand Down
155 changes: 155 additions & 0 deletions tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,158 @@ Feature: upload file to shared folder
| dav_version |
| old |
| new |


Scenario Outline: Upload a file to shared folder with checksum should return the checksum in the propfind for sharee
Given using <dav_version> DAV path
And user "Alice" has created folder "/FOLDER"
And user "Alice" has shared folder "/FOLDER" with user "Brian"
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
And user "Alice" has created a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 5 |
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
And user "Alice" has uploaded file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513964" to the last created TUS Location with offset "0" and content "12345" using the TUS protocol on the WebDAV API
When user "Brian" requests the checksum of "/Shares/FOLDER/textFile.txt" via propfind
Then the webdav checksum should match "SHA1:8cb2237d0679ca88db6464eac60da96345513964 MD5:827ccb0eea8a706c4c34a16891f84e7b ADLER32:02f80100"
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Upload a file to shared folder with checksum should return the checksum in the download header for sharee
Given using <dav_version> DAV path
And user "Alice" has created folder "/FOLDER"
And user "Alice" has shared folder "/FOLDER" with user "Brian"
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
And user "Alice" has created a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 5 |
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
And user "Alice" has uploaded file with checksum "SHA1 8cb2237d069ca88db6464eac60da96345513964" to the last created TUS Location with offset "0" and content "12345" using the TUS protocol on the WebDAV API
When user "Brian" downloads file "/Shares/FOLDER/textFile.txt" using the WebDAV API
Then the header checksum should match "SHA1:8cb2237d0679ca88db6464eac60da96345513964"
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Sharer shares a file with correct checksum should return the checksum in the propfind for sharee
Given using <dav_version> DAV path
And user "Alice" has created a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 5 |
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
And user "Alice" has uploaded file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513964" to the last created TUS Location with offset "0" and content "12345" using the TUS protocol on the WebDAV API
And user "Alice" has shared file "/textFile.txt" with user "Brian"
And user "Brian" has accepted share "/textFile.txt" offered by user "Alice"
When user "Brian" requests the checksum of "/Shares/textFile.txt" via propfind
Then the webdav checksum should match "SHA1:8cb2237d0679ca88db6464eac60da96345513964 MD5:827ccb0eea8a706c4c34a16891f84e7b ADLER32:02f80100"
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Sharer shares a file with correct checksum should return the checksum in the download header for sharee
Given using <dav_version> DAV path
And user "Alice" has created a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 5 |
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
And user "Alice" has uploaded file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513964" to the last created TUS Location with offset "0" and content "12345" using the TUS protocol on the WebDAV API
And user "Alice" has shared file "/textFile.txt" with user "Brian"
And user "Brian" has accepted share "/textFile.txt" offered by user "Alice"
When user "Brian" downloads file "/Shares/textFile.txt" using the WebDAV API
Then the header checksum should match "SHA1:8cb2237d0679ca88db6464eac60da96345513964"
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Sharee uploads a file to a received share folder with correct checksum
Given using <dav_version> DAV path
And user "Alice" has created folder "/FOLDER"
And user "Alice" has shared folder "/FOLDER" with user "Brian"
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
When user "Brian" creates a new TUS resource on the WebDAV API with these headers:
| Tus-Resumable | 1.0.0 |
| Upload-Length | 16 |
| Upload-Metadata | filename L1NoYXJlcy9GT0xERVIvdGV4dGZpbGUudHh0 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is hard to understand the encrypted name and would have been better if there is a comment somewhere that says what is the actual name of this file.
But, that's just a suggestion. Everything looks good to me anyway. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The encrypted file name can be seen here https://github.com/owncloud/core/pull/38484/files#diff-0613ee3f838a6348f280cfa6593798e61953aea15b0fb94b85d92335095700d9R91.

So far for all the tests we haven't mentioned the encrypted file name(which is sent as metadata to created the file) in any comments so I don't if we should or shouldn't do it. @individual-it what do you think about this idea of mentioning encrypted filename in a comment?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to mention. maybe let's have an other PR doing that for all places

And user "Brian" uploads file with checksum "MD5 827ccb0eea8a706c4c34a16891f84e7b" to the last created TUS Location with offset "0" and content "uploaded content" using the TUS protocol on the WebDAV API
Then as "Alice" file "/FOLDER/textFile.txt" should exist
And the content of file "/FOLDER/textFile.txt" for user "Alice" should be "uploaded content"
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Sharee uploads a file to a received share folder with wrong checksum should not work
Given using <dav_version> DAV path
And user "Alice" has created folder "/FOLDER"
And user "Alice" has shared folder "/FOLDER" with user "Brian"
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
When user "Brian" creates a new TUS resource on the WebDAV API with these headers:
| Tus-Resumable | 1.0.0 |
| Upload-Length | 16 |
| Upload-Metadata | filename L1NoYXJlcy9GT0xERVIvdGV4dGZpbGUudHh0 |
And user "Brian" uploads file with checksum "MD5 827ccb0eea8a706c4c34a16891f84e8c" to the last created TUS Location with offset "0" and content "uploaded content" using the TUS protocol on the WebDAV API
Then the HTTP status code should be "406"
And as "Alice" file "/FOLDER/textFile.txt" should not exist
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Sharer uploads a file to shared folder with wrong correct checksum should not work
Given using <dav_version> DAV path
And user "Alice" has created folder "/FOLDER"
And user "Alice" has shared folder "/FOLDER" with user "Brian"
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
And user "Alice" has created a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 5 |
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
When user "Alice" uploads file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513954" to the last created TUS Location with offset "0" and content "uploaded content" using the TUS protocol on the WebDAV API
Then the HTTP status code should be "406"
And as "Alice" file "/FOLDER/textFile.txt" should not exist
And as "Brian" file "/Shares/FOLDER/textFile.txt" should not exist
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Sharer uploads a chunked file with correct checksum and share it with sharee should work
Given using <dav_version> DAV path
And user "Alice" has created a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 10 |
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
When user "Alice" sends a chunk to the last created TUS Location with offset "0" and data "01234" with checksum "MD5 4100c4d44da9177247e44a5fc1546778" using the TUS protocol on the WebDAV API
And user "Alice" sends a chunk to the last created TUS Location with offset "5" and data "56789" with checksum "MD5 099ebea48ea9666a7da2177267983138" using the TUS protocol on the WebDAV API
And user "Alice" shares file "textFile.txt" with user "Brian" using the sharing API
And user "Brian" accepts share "/textFile.txt" offered by user "Alice" using the sharing API
Then the content of file "/Shares/textFile.txt" for user "Brian" should be "0123456789"
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Sharee uploads a chunked file with correct checksum to a received share folder should work
Given using <dav_version> DAV path
And user "Alice" has created folder "/FOLDER"
And user "Alice" has shared folder "/FOLDER" with user "Brian"
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
And user "Brian" creates a new TUS resource on the WebDAV API with these headers:
| Tus-Resumable | 1.0.0 |
| Upload-Length | 10 |
| Upload-Metadata | filename L1NoYXJlcy9GT0xERVIvdGV4dGZpbGUudHh0 |
When user "Brian" sends a chunk to the last created TUS Location with offset "0" and data "01234" with checksum "MD5 4100c4d44da9177247e44a5fc1546778" using the TUS protocol on the WebDAV API
And user "Brian" sends a chunk to the last created TUS Location with offset "5" and data "56789" with checksum "MD5 099ebea48ea9666a7da2177267983138" using the TUS protocol on the WebDAV API
Then as "Alice" file "/FOLDER/textFile.txt" should exist
And the content of file "/FOLDER/textFile.txt" for user "Alice" should be "0123456789"
Examples:
| dav_version |
| old |
| new |