diff --git a/tests/acceptance/bootstrap/SpacesTUSContext.php b/tests/acceptance/bootstrap/SpacesTUSContext.php index 599f1b1bf4d..9ef4b06fb84 100644 --- a/tests/acceptance/bootstrap/SpacesTUSContext.php +++ b/tests/acceptance/bootstrap/SpacesTUSContext.php @@ -185,7 +185,11 @@ class SpacesTUSContext implements Context { string $resource, string $spaceName ): ResponseInterface { - $spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName); + if ($spaceName === 'Shares') { + $spaceId = GraphHelper::SHARES_SPACE_ID; + } else { + $spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName); + } $tmpFile = $this->tusContext->writeDataToTempFile($content); $response = $this->tusContext->uploadFileUsingTus( $user, @@ -246,6 +250,11 @@ class SpacesTUSContext implements Context { string $resource, string $spaceName ): void { + $isSpacesDavPathVersion = $this->featureContext->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES; + if (!$isSpacesDavPathVersion) { + $resource = \ltrim($resource, "/"); + $resource = 'Shares/' . $resource; + } $this->featureContext->setResponse($this->uploadFileViaTus($user, $content, $resource, $spaceName)); } diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 03a0f2a0dc7..c34d47bdbc8 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -803,6 +803,7 @@ default: - FilesVersionsContext: - ChecksumContext: - SharingNgContext: + - SpacesTUSContext: coreApiWebdavEtagPropagation1: paths: diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 533ed69753c..d67af4f07be 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -137,12 +137,12 @@ _ocdav: api compatibility, return correct status code_ - [coreApiWebdavUploadTUS/checksums.feature:243](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/checksums.feature#L243) - [coreApiWebdavUploadTUS/checksums.feature:244](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/checksums.feature#L244) - [coreApiWebdavUploadTUS/checksums.feature:245](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/checksums.feature#L245) -- [coreApiWebdavUploadTUS/uploadToShare.feature:260](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L260) -- [coreApiWebdavUploadTUS/uploadToShare.feature:261](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L261) -- [coreApiWebdavUploadTUS/uploadToShare.feature:284](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L284) -- [coreApiWebdavUploadTUS/uploadToShare.feature:285](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L285) -- [coreApiWebdavUploadTUS/uploadToShare.feature:381](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L381) -- [coreApiWebdavUploadTUS/uploadToShare.feature:382](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L382) +- [coreApiWebdavUploadTUS/uploadToShare.feature:264](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L264) +- [coreApiWebdavUploadTUS/uploadToShare.feature:265](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L265) +- [coreApiWebdavUploadTUS/uploadToShare.feature:288](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L288) +- [coreApiWebdavUploadTUS/uploadToShare.feature:289](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L289) +- [coreApiWebdavUploadTUS/uploadToShare.feature:385](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L385) +- [coreApiWebdavUploadTUS/uploadToShare.feature:386](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L386) #### [Renaming resource to banned name is allowed in spaces webdav](https://github.com/owncloud/ocis/issues/3099) diff --git a/tests/acceptance/expected-failures-without-remotephp.md b/tests/acceptance/expected-failures-without-remotephp.md index 7f0081946d8..c7f572279aa 100644 --- a/tests/acceptance/expected-failures-without-remotephp.md +++ b/tests/acceptance/expected-failures-without-remotephp.md @@ -354,9 +354,9 @@ - [coreApiWebdavUploadTUS/uploadFileMtimeShares.feature:93](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFileMtimeShares.feature#L93) - [coreApiWebdavUploadTUS/uploadToMoveFolder.feature:21](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToMoveFolder.feature#L21) - [coreApiWebdavUploadTUS/uploadToShare.feature:30](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L30) -- [coreApiWebdavUploadTUS/uploadToShare.feature:50](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L50) -- [coreApiWebdavUploadTUS/uploadToShare.feature:72](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L72) -- [coreApiWebdavUploadTUS/uploadToShare.feature:93](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L93) +- [coreApiWebdavUploadTUS/uploadToShare.feature:51](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L51) +- [coreApiWebdavUploadTUS/uploadToShare.feature:74](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L74) +- [coreApiWebdavUploadTUS/uploadToShare.feature:96](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature#L96) #### [PROPFIND to /webdav root (old dav path) without remote.php returns html instead of xml](https://github.com/owncloud/ocis/issues/10334) diff --git a/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToNonExistingFolder.feature b/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToNonExistingFolder.feature index 83ed5ae1ac6..54be8c8daa6 100644 --- a/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToNonExistingFolder.feature +++ b/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToNonExistingFolder.feature @@ -10,7 +10,7 @@ Feature: upload file Scenario Outline: attempt to upload a file into a nonexistent shares Given using DAV path - When user "Alice" uploads file with content "uploaded content" to "/Shares/FOLDER/textfile.txt" using the TUS protocol on the WebDAV API + When user "Alice" uploads a file with content "uploaded content" to "/Shares/FOLDER/textfile.txt" via TUS inside of the space "Personal" using the WebDAV API Then the HTTP status code should be "412" And as "Alice" folder "/Shares/FOLDER/" should not exist And as "Alice" file "/Shares/FOLDER/textfile.txt" should not exist @@ -27,7 +27,7 @@ Feature: upload file Scenario Outline: attempt to upload a file into a nonexistent folder Given using DAV path - When user "Alice" uploads file with content "uploaded content" to "/nonExistentFolder/textfile.txt" using the TUS protocol on the WebDAV API + When user "Alice" uploads a file with content "uploaded content" to "/nonExistentFolder/textfile.txt" via TUS inside of the space "Personal" using the WebDAV API Then the HTTP status code should be "412" And as "Alice" folder "/nonExistentFolder" should not exist And as "Alice" file "/nonExistentFolder/textfile.txt" should not exist @@ -53,7 +53,7 @@ Feature: upload file | shareType | user | | permissionsRole | Editor | And user "Brian" has a share "FOLDER" synced - When user "Brian" uploads file with content "uploaded content" to "/Shares/FOLDER/nonExistentFolder/textfile.txt" using the TUS protocol on the WebDAV API + When user "Brian" uploads a file with content "uploaded content" to "FOLDER/nonExistentFolder/textfile.txt" via TUS inside of the space "Shares" using the WebDAV API Then the HTTP status code should be "412" And as "Brian" folder "/Shares/FOLDER/nonExistentFolder" should not exist And as "Brian" file "/Shares/FOLDER/nonExistentFolder/textfile.txt" should not exist diff --git a/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature b/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature index 08ae5dbf328..06aff167712 100644 --- a/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature +++ b/tests/acceptance/features/coreApiWebdavUploadTUS/uploadToShare.feature @@ -21,7 +21,7 @@ Feature: upload file to shared folder | shareType | user | | permissionsRole | Editor | And user "Brian" has a share "FOLDER" synced - When user "Brian" uploads file with content "uploaded content" to "/Shares/FOLDER/textfile.txt" using the TUS protocol on the WebDAV API + When user "Brian" uploads a file with content "uploaded content" to "FOLDER/textfile.txt" via TUS inside of the space "Shares" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" file "/FOLDER/textfile.txt" should exist And the content of file "/FOLDER/textfile.txt" for user "Alice" should be "uploaded content" @@ -29,6 +29,7 @@ Feature: upload file to shared folder | dav-path-version | | old | | new | + | spaces | @issue-10346 Scenario Outline: uploading file to a user read/write share folder works @@ -41,7 +42,7 @@ Feature: upload file to shared folder | shareType | user | | permissionsRole | Uploader | And user "Brian" has a share "FOLDER" synced - When user "Brian" uploads file with content "uploaded content" to "/Shares/FOLDER/textfile.txt" using the TUS protocol on the WebDAV API + When user "Brian" uploads a file with content "uploaded content" to "FOLDER/textfile.txt" via TUS inside of the space "Shares" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" file "/FOLDER/textfile.txt" should exist And the content of file "/FOLDER/textfile.txt" for user "Alice" should be "uploaded content" @@ -49,6 +50,7 @@ Feature: upload file to shared folder | dav-path-version | | old | | new | + | spaces | @issue-10346 Scenario Outline: uploading a file into a group share as share receiver @@ -63,7 +65,7 @@ Feature: upload file to shared folder | shareType | group | | permissionsRole | Uploader | And user "Brian" has a share "FOLDER" synced - When user "Brian" uploads file with content "uploaded content" to "/Shares/FOLDER/textfile.txt" using the TUS protocol on the WebDAV API + When user "Brian" uploads a file with content "uploaded content" to "FOLDER/textfile.txt" via TUS inside of the space "Shares" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" file "/FOLDER/textfile.txt" should exist And the content of file "/FOLDER/textfile.txt" for user "Alice" should be "uploaded content" @@ -71,6 +73,7 @@ Feature: upload file to shared folder | dav-path-version | | old | | new | + | spaces | @issue-10346 Scenario Outline: overwrite file to a received share folder @@ -84,7 +87,7 @@ Feature: upload file to shared folder | shareType | user | | permissionsRole | Editor | And user "Brian" has a share "FOLDER" synced - When user "Brian" uploads file with content "overwritten content" to "/Shares/FOLDER/textfile.txt" using the TUS protocol on the WebDAV API + When user "Brian" uploads a file with content "overwritten content" to "FOLDER/textfile.txt" via TUS inside of the space "Shares" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" file "/FOLDER/textfile.txt" should exist And the content of file "/FOLDER/textfile.txt" for user "Alice" should be "overwritten content" @@ -92,6 +95,7 @@ Feature: upload file to shared folder | dav-path-version | | old | | new | + | spaces | @issue-10346 Scenario Outline: attempt to upload a file into a folder within correctly received read only share @@ -104,8 +108,8 @@ Feature: upload file to shared folder | shareType | user | | permissionsRole | Viewer | And user "Brian" has a share "FOLDER" synced - When user "Brian" uploads file with content "uploaded content" to "/Shares/FOLDER/textfile.txt" using the TUS protocol on the WebDAV API - Then the HTTP status code should be "412" + When user "Brian" uploads a file with content "uploaded content" to "FOLDER/textfile.txt" via TUS inside of the space "Shares" using the WebDAV API + Then the HTTP status code should be "403" And as "Brian" file "/Shares/FOLDER/textfile.txt" should not exist Examples: | dav-path-version |