From 3dc17bf737afc42b76920600d3b39e4453a22a06 Mon Sep 17 00:00:00 2001 From: swoichha Date: Tue, 9 Mar 2021 16:57:40 +0545 Subject: [PATCH 1/2] add tests for uploading to shared files --- .../apiWebdavUploadTUS/checksums.feature | 1 - .../apiWebdavUploadTUS/uploadToShare.feature | 150 ++++++++++++++++++ 2 files changed, 150 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiWebdavUploadTUS/checksums.feature b/tests/acceptance/features/apiWebdavUploadTUS/checksums.feature index 40df7f22c076..89919e230240 100644 --- a/tests/acceptance/features/apiWebdavUploadTUS/checksums.feature +++ b/tests/acceptance/features/apiWebdavUploadTUS/checksums.feature @@ -45,7 +45,6 @@ Feature: checksums | old | | new | - Scenario Outline: Uploading a file with incorrect checksum should not work Given using DAV path And user "Alice" has created a new TUS resource on the WebDAV API with these headers: diff --git a/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature b/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature index 378a4066bc1a..7c5cb6e7923e 100644 --- a/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature +++ b/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature @@ -77,3 +77,153 @@ 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 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 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 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 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 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 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 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 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 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 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 | From 51fafc8edeffb2036b4a5f61c67752a348aba6e7 Mon Sep 17 00:00:00 2001 From: swoichha Date: Wed, 10 Mar 2021 16:27:10 +0545 Subject: [PATCH 2/2] added extra line after each test --- .../acceptance/features/apiWebdavUploadTUS/checksums.feature | 1 + .../features/apiWebdavUploadTUS/uploadToShare.feature | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tests/acceptance/features/apiWebdavUploadTUS/checksums.feature b/tests/acceptance/features/apiWebdavUploadTUS/checksums.feature index 89919e230240..c3c6d45e4d3d 100644 --- a/tests/acceptance/features/apiWebdavUploadTUS/checksums.feature +++ b/tests/acceptance/features/apiWebdavUploadTUS/checksums.feature @@ -45,6 +45,7 @@ Feature: checksums | old | | new | + Scenario Outline: Uploading a file with incorrect checksum should not work Given using DAV path And user "Alice" has created a new TUS resource on the WebDAV API with these headers: diff --git a/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature b/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature index 7c5cb6e7923e..d9b8c6835546 100644 --- a/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature +++ b/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature @@ -78,6 +78,7 @@ Feature: upload file to shared folder | old | | new | + Scenario Outline: Upload a file to shared folder with checksum should return the checksum in the propfind for sharee Given using DAV path And user "Alice" has created folder "/FOLDER" @@ -94,6 +95,7 @@ Feature: upload file to shared folder | 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 path And user "Alice" has created folder "/FOLDER" @@ -110,6 +112,7 @@ Feature: upload file to shared folder | old | | new | + Scenario Outline: Sharer shares a file with correct checksum should return the checksum in the propfind for sharee Given using DAV path And user "Alice" has created a new TUS resource on the WebDAV API with these headers: @@ -159,6 +162,7 @@ Feature: upload file to shared folder | old | | new | + Scenario Outline: Sharee uploads a file to a received share folder with wrong checksum should not work Given using DAV path And user "Alice" has created folder "/FOLDER" @@ -210,6 +214,7 @@ Feature: upload file to shared folder | old | | new | + Scenario Outline: Sharee uploads a chunked file with correct checksum to a received share folder should work Given using DAV path And user "Alice" has created folder "/FOLDER"