From f257ddedbb86c7eddba0e183cfbcbd9389fd84e6 Mon Sep 17 00:00:00 2001 From: nabim777 Date: Mon, 9 Dec 2024 15:18:18 +0545 Subject: [PATCH 1/5] add tests for uploading the zero-byte via tus and webdav api Signed-off-by: nabim777 --- .../acceptance/bootstrap/SpacesTUSContext.php | 19 +++++++ tests/acceptance/bootstrap/TUSContext.php | 38 +++++++++++++ .../createLinkShare.feature | 55 ++++++++++++++++++- .../features/apiSpaces/tusUpload.feature | 50 +++++++++++++++++ 4 files changed, 161 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/bootstrap/SpacesTUSContext.php b/tests/acceptance/bootstrap/SpacesTUSContext.php index a179244d7ef..33a87b7bdc7 100644 --- a/tests/acceptance/bootstrap/SpacesTUSContext.php +++ b/tests/acceptance/bootstrap/SpacesTUSContext.php @@ -95,6 +95,25 @@ public function userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi( $this->featureContext->setLastUploadDeleteTime(\time()); } + /** + * @When the public uploads a file from :source to :destination via TUS inside last link shared folder with password :password using the WebDAV API + * + * @param string $source + * @param string $destination + * @param string $password + * + * @return void + * @throws Exception + */ + public function publicUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi( + string $source, + string $destination, + string $password + ): void { + $this->tusContext->publicUploadFileUsingTus($source, $destination, $password); + $this->featureContext->setLastUploadDeleteTime(\time()); + } + /** * @Given user :user has created a new TUS resource in the space :spaceName with the following headers: * diff --git a/tests/acceptance/bootstrap/TUSContext.php b/tests/acceptance/bootstrap/TUSContext.php index 4d023a0e01c..35d1fcd48f8 100644 --- a/tests/acceptance/bootstrap/TUSContext.php +++ b/tests/acceptance/bootstrap/TUSContext.php @@ -344,6 +344,44 @@ public function uploadFileUsingTus( } } + /** + * @param string $source + * @param string $destination + * @param string|null $password + * + * @return void + */ + public function publicUploadFileUsingTus( + string $source, + string $destination, + ?string $password, + ):void { + $password = $this->featureContext->getActualPassword($password); + if ($this->featureContext->isUsingSharingNG()) { + $token = $this->featureContext->shareNgGetLastCreatedLinkShareToken(); + } else { + $token = $this->featureContext->getLastCreatedPublicShareToken(); + } + $headers = [ + 'Authorization' => 'Basic ' . \base64_encode("public" . ':' . $password), + ]; + $sourceFile = $this->featureContext->acceptanceTestsDirLocation() . $source; + $davPath = WebdavHelper::getDavPath(WebDavHelper::DAV_VERSION_SPACES, $token, "public-files"); + $url = $davPath; + + $client = new Client( + $this->featureContext->getBaseUrl(), + [ + 'verify' => false, + 'headers' => $headers + ] + ); + + $client->setApiPath($url); + $client->setKey((string)rand())->file($sourceFile, $destination); + $client->file($sourceFile, $destination)->createWithUpload("", 0); + } + /** * @When user :user uploads file with content :content to :destination using the TUS protocol on the WebDAV API * diff --git a/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature b/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature index 17834133a75..fd1f40b9213 100644 --- a/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature +++ b/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature @@ -2763,4 +2763,57 @@ Feature: Create a link share for a resource | permissions-role | | Space Viewer | | Space Editor | - | Manager | \ No newline at end of file + | Manager | + + @issue-10649 + Scenario: public uploads a zero byte file to a public share folder + Given using spaces DAV path + And using SharingNG + And user "Alice" has created folder "/uploadFolder" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Personal | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" folder "uploadFolder" of the space "Personal" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: + | textfile (1).txt | + + @issue-10649 + Scenario: public uploads a zero byte file to a public share folder inside project space + Given using spaces DAV path + And using SharingNG + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "Project" with the default quota using the Graph API + And user "Alice" has created a folder "/uploadFolder" in space "Project" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Project | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" folder "uploadFolder" of the space "Project" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Project" should not contain these files: + | textfile (1).txt | + + @issue-10649 + Scenario: public uploads a zero byte file to a public share project space + Given using spaces DAV path + And using SharingNG + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "Project" with the default quota using the Graph API + And user "Alice" has created the following space link share: + | space | Project | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project" should contain these files: + | textfile.txt | + And for user "Alice" the space "Project" should not contain these files: + | textfile (1).txt | diff --git a/tests/acceptance/features/apiSpaces/tusUpload.feature b/tests/acceptance/features/apiSpaces/tusUpload.feature index 34f561b841e..eaa5acc9dda 100644 --- a/tests/acceptance/features/apiSpaces/tusUpload.feature +++ b/tests/acceptance/features/apiSpaces/tusUpload.feature @@ -144,3 +144,53 @@ Feature: upload resources using TUS protocol When user "Brian" uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside of the space "new-space" using the WebDAV API Then for user "Brian" the content of the file "textfile.txt" of the space "new-space" should be "" And for user "Alice" the content of the file "textfile.txt" of the space "new-space" should be "" + + @issue-10649 + Scenario: public uploads a zero byte file to a public share folder + Given using spaces DAV path + And using SharingNG + And user "Alice" has created folder "/uploadFolder" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Personal | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API + And for user "Alice" folder "uploadFolder" of the space "Personal" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: + | textfile (1).txt | + + @issue-10346 + Scenario: public uploads a zero-byte file to a shared folder inside project space + Given using spaces DAV path + And using SharingNG + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "Project" with the default quota using the Graph API + And user "Alice" has created a folder "/uploadFolder" in space "Project" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Project | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API + And for user "Alice" folder "uploadFolder" of the space "Project" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Project" should not contain these files: + | textfile (1).txt | + + @issue-10649 + Scenario: public uploads a zero-byte file to a public share project space + Given using spaces DAV path + And using SharingNG + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "Project" with the default quota using the Graph API + And user "Alice" has created the following space link share: + | space | Project | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API + Then for user "Alice" the space "Project" should contain these files: + | textfile.txt | + And for user "Alice" the space "Project" should not contain these files: + | textfile (1).txt | From 881a7c1092508105496b7bd7fe206c99571b3df4 Mon Sep 17 00:00:00 2001 From: nabim777 Date: Mon, 9 Dec 2024 16:16:30 +0545 Subject: [PATCH 2/5] change the file Signed-off-by: nabim777 --- tests/acceptance/bootstrap/TUSContext.php | 3 +- .../createLinkShare.feature | 53 ------------------- .../features/apiSpaces/tusUpload.feature | 50 ----------------- .../features/apiSpaces/uploadSpaces.feature | 46 ++++++++++++++++ .../apiSpacesShares/shareUploadTUS.feature | 47 ++++++++++++++++ 5 files changed, 94 insertions(+), 105 deletions(-) diff --git a/tests/acceptance/bootstrap/TUSContext.php b/tests/acceptance/bootstrap/TUSContext.php index 35d1fcd48f8..98a68ae4374 100644 --- a/tests/acceptance/bootstrap/TUSContext.php +++ b/tests/acceptance/bootstrap/TUSContext.php @@ -366,8 +366,7 @@ public function publicUploadFileUsingTus( 'Authorization' => 'Basic ' . \base64_encode("public" . ':' . $password), ]; $sourceFile = $this->featureContext->acceptanceTestsDirLocation() . $source; - $davPath = WebdavHelper::getDavPath(WebDavHelper::DAV_VERSION_SPACES, $token, "public-files"); - $url = $davPath; + $url = WebdavHelper::getDavPath(WebDavHelper::DAV_VERSION_SPACES, $token, "public-files"); $client = new Client( $this->featureContext->getBaseUrl(), diff --git a/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature b/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature index fd1f40b9213..8415a4c89cd 100644 --- a/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature +++ b/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature @@ -2764,56 +2764,3 @@ Feature: Create a link share for a resource | Space Viewer | | Space Editor | | Manager | - - @issue-10649 - Scenario: public uploads a zero byte file to a public share folder - Given using spaces DAV path - And using SharingNG - And user "Alice" has created folder "/uploadFolder" - And user "Alice" has created the following resource link share: - | resource | uploadFolder | - | space | Personal | - | permissionsRole | createOnly | - | password | %public% | - When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API - Then the HTTP status code should be "201" - And for user "Alice" folder "uploadFolder" of the space "Personal" should contain these files: - | textfile.txt | - And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: - | textfile (1).txt | - - @issue-10649 - Scenario: public uploads a zero byte file to a public share folder inside project space - Given using spaces DAV path - And using SharingNG - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "Project" with the default quota using the Graph API - And user "Alice" has created a folder "/uploadFolder" in space "Project" - And user "Alice" has created the following resource link share: - | resource | uploadFolder | - | space | Project | - | permissionsRole | createOnly | - | password | %public% | - When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API - Then the HTTP status code should be "201" - And for user "Alice" folder "uploadFolder" of the space "Project" should contain these files: - | textfile.txt | - And for user "Alice" folder "uploadFolder" of the space "Project" should not contain these files: - | textfile (1).txt | - - @issue-10649 - Scenario: public uploads a zero byte file to a public share project space - Given using spaces DAV path - And using SharingNG - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "Project" with the default quota using the Graph API - And user "Alice" has created the following space link share: - | space | Project | - | permissionsRole | createOnly | - | password | %public% | - When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API - Then the HTTP status code should be "201" - And for user "Alice" the space "Project" should contain these files: - | textfile.txt | - And for user "Alice" the space "Project" should not contain these files: - | textfile (1).txt | diff --git a/tests/acceptance/features/apiSpaces/tusUpload.feature b/tests/acceptance/features/apiSpaces/tusUpload.feature index eaa5acc9dda..34f561b841e 100644 --- a/tests/acceptance/features/apiSpaces/tusUpload.feature +++ b/tests/acceptance/features/apiSpaces/tusUpload.feature @@ -144,53 +144,3 @@ Feature: upload resources using TUS protocol When user "Brian" uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside of the space "new-space" using the WebDAV API Then for user "Brian" the content of the file "textfile.txt" of the space "new-space" should be "" And for user "Alice" the content of the file "textfile.txt" of the space "new-space" should be "" - - @issue-10649 - Scenario: public uploads a zero byte file to a public share folder - Given using spaces DAV path - And using SharingNG - And user "Alice" has created folder "/uploadFolder" - And user "Alice" has created the following resource link share: - | resource | uploadFolder | - | space | Personal | - | permissionsRole | createOnly | - | password | %public% | - When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API - And for user "Alice" folder "uploadFolder" of the space "Personal" should contain these files: - | textfile.txt | - And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: - | textfile (1).txt | - - @issue-10346 - Scenario: public uploads a zero-byte file to a shared folder inside project space - Given using spaces DAV path - And using SharingNG - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "Project" with the default quota using the Graph API - And user "Alice" has created a folder "/uploadFolder" in space "Project" - And user "Alice" has created the following resource link share: - | resource | uploadFolder | - | space | Project | - | permissionsRole | createOnly | - | password | %public% | - When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API - And for user "Alice" folder "uploadFolder" of the space "Project" should contain these files: - | textfile.txt | - And for user "Alice" folder "uploadFolder" of the space "Project" should not contain these files: - | textfile (1).txt | - - @issue-10649 - Scenario: public uploads a zero-byte file to a public share project space - Given using spaces DAV path - And using SharingNG - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "Project" with the default quota using the Graph API - And user "Alice" has created the following space link share: - | space | Project | - | permissionsRole | createOnly | - | password | %public% | - When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API - Then for user "Alice" the space "Project" should contain these files: - | textfile.txt | - And for user "Alice" the space "Project" should not contain these files: - | textfile (1).txt | diff --git a/tests/acceptance/features/apiSpaces/uploadSpaces.feature b/tests/acceptance/features/apiSpaces/uploadSpaces.feature index 8ed3964b2d6..9814aae2b4e 100644 --- a/tests/acceptance/features/apiSpaces/uploadSpaces.feature +++ b/tests/acceptance/features/apiSpaces/uploadSpaces.feature @@ -93,3 +93,49 @@ Feature: Upload files into a space | folder-name | | foo/bar | | foo/bar/baz | + + @issue-10649 + Scenario: public uploads a zero byte file to a public share folder + Given using SharingNG + And user "Alice" has created folder "/uploadFolder" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Personal | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" folder "uploadFolder" of the space "Personal" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: + | textfile (1).txt | + + @issue-10649 + Scenario: public uploads a zero byte file to a public share folder inside project space + Given using SharingNG + And user "Alice" has created a folder "/uploadFolder" in space "Project Ceres" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Project Ceres | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" folder "uploadFolder" of the space "Project Ceres" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Project Ceres" should not contain these files: + | textfile (1).txt | + + @issue-10649 + Scenario: public uploads a zero byte file to a public share project space + Given using SharingNG + And user "Alice" has created the following space link share: + | space | Project Ceres | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project Ceres" should contain these files: + | textfile.txt | + And for user "Alice" the space "Project Ceres" should not contain these files: + | textfile (1).txt | diff --git a/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature b/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature index e17dcc24e83..e166256b095 100644 --- a/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature +++ b/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature @@ -402,3 +402,50 @@ Feature: upload resources on share using TUS protocol | Tus-Resumable | 1.0.0 | Then the HTTP status code should be "460" And for user "Alice" the content of the file "/textFile.txt" of the space "Personal" should be "original content" + + @issue-10649 + Scenario: public uploads a zero byte file to a public share folder + Given using SharingNG + And user "Alice" has created folder "/uploadFolder" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Personal | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API + And for user "Alice" folder "uploadFolder" of the space "Personal" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: + | textfile (1).txt | + + @issue-10649 + Scenario: public uploads a zero-byte file to a shared folder inside project space + Given using SharingNG + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "Project" with the default quota using the Graph API + And user "Alice" has created a folder "/uploadFolder" in space "Project" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Project | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API + And for user "Alice" folder "uploadFolder" of the space "Project" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Project" should not contain these files: + | textfile (1).txt | + + @issue-10649 + Scenario: public uploads a zero-byte file to a public share project space + Given using SharingNG + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "Project" with the default quota using the Graph API + And user "Alice" has created the following space link share: + | space | Project | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API + Then for user "Alice" the space "Project" should contain these files: + | textfile.txt | + And for user "Alice" the space "Project" should not contain these files: + | textfile (1).txt | From c42745e8d1d27d5d9fad12e8d7018423a7a34822 Mon Sep 17 00:00:00 2001 From: nabim777 Date: Tue, 10 Dec 2024 13:56:34 +0545 Subject: [PATCH 3/5] add scenario in expected failure Signed-off-by: nabim777 --- tests/acceptance/bootstrap/TUSContext.php | 4 ++-- .../expected-failures-without-remotephp.md | 6 ++++++ .../features/apiSpaces/uploadSpaces.feature | 20 +++++++++---------- .../apiSpacesShares/shareUploadTUS.feature | 8 ++++---- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/acceptance/bootstrap/TUSContext.php b/tests/acceptance/bootstrap/TUSContext.php index 98a68ae4374..f97ee8c82f9 100644 --- a/tests/acceptance/bootstrap/TUSContext.php +++ b/tests/acceptance/bootstrap/TUSContext.php @@ -347,14 +347,14 @@ public function uploadFileUsingTus( /** * @param string $source * @param string $destination - * @param string|null $password + * @param string $password * * @return void */ public function publicUploadFileUsingTus( string $source, string $destination, - ?string $password, + string $password, ):void { $password = $this->featureContext->getActualPassword($password); if ($this->featureContext->isUsingSharingNG()) { diff --git a/tests/acceptance/expected-failures-without-remotephp.md b/tests/acceptance/expected-failures-without-remotephp.md index f4fb796c5db..120d9635765 100644 --- a/tests/acceptance/expected-failures-without-remotephp.md +++ b/tests/acceptance/expected-failures-without-remotephp.md @@ -195,6 +195,12 @@ - [apiSpaces/publicLink.feature:28](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/publicLink.feature#L28) - [apiSpaces/publicLink.feature:34](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/publicLink.feature#L34) - [apiSpaces/publicLink.feature:40](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/publicLink.feature#L40) +- [apiSpaces/uploadSpaces.feature:98](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L98) +- [apiSpaces/uploadSpaces.feature:114](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L114) +- [apiSpaces/uploadSpaces.feature:130](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L130) +- [apiSpacesShares/shareUploadTUS.feature:407](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L407) +- [apiSpacesShares/shareUploadTUS.feature:422](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L422) +- [apiSpacesShares/shareUploadTUS.feature:439](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L439) - [apiSpacesShares/shareSpacesViaLink.feature:61](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature#L61) - [apiDepthInfinity/propfind.feature:74](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiDepthInfinity/propfind.feature#L74) - [apiDepthInfinity/propfind.feature:124](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiDepthInfinity/propfind.feature#L124) diff --git a/tests/acceptance/features/apiSpaces/uploadSpaces.feature b/tests/acceptance/features/apiSpaces/uploadSpaces.feature index 9814aae2b4e..82bc6ac0ba8 100644 --- a/tests/acceptance/features/apiSpaces/uploadSpaces.feature +++ b/tests/acceptance/features/apiSpaces/uploadSpaces.feature @@ -94,7 +94,7 @@ Feature: Upload files into a space | foo/bar | | foo/bar/baz | - @issue-10649 + @issue-10331 @issue-10469 Scenario: public uploads a zero byte file to a public share folder Given using SharingNG And user "Alice" has created folder "/uploadFolder" @@ -110,15 +110,15 @@ Feature: Upload files into a space And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: | textfile (1).txt | - @issue-10649 + @issue-10331 @issue-10469 Scenario: public uploads a zero byte file to a public share folder inside project space Given using SharingNG And user "Alice" has created a folder "/uploadFolder" in space "Project Ceres" And user "Alice" has created the following resource link share: - | resource | uploadFolder | - | space | Project Ceres | - | permissionsRole | createOnly | - | password | %public% | + | resource | uploadFolder | + | space | Project Ceres | + | permissionsRole | createOnly | + | password | %public% | When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API Then the HTTP status code should be "201" And for user "Alice" folder "uploadFolder" of the space "Project Ceres" should contain these files: @@ -126,13 +126,13 @@ Feature: Upload files into a space And for user "Alice" folder "uploadFolder" of the space "Project Ceres" should not contain these files: | textfile (1).txt | - @issue-10649 + @issue-10331 @issue-10469 Scenario: public uploads a zero byte file to a public share project space Given using SharingNG And user "Alice" has created the following space link share: - | space | Project Ceres | - | permissionsRole | createOnly | - | password | %public% | + | space | Project Ceres | + | permissionsRole | createOnly | + | password | %public% | When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API Then the HTTP status code should be "201" And for user "Alice" the space "Project Ceres" should contain these files: diff --git a/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature b/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature index e166256b095..90cd82e20cc 100644 --- a/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature +++ b/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature @@ -403,7 +403,7 @@ Feature: upload resources on share using TUS protocol Then the HTTP status code should be "460" And for user "Alice" the content of the file "/textFile.txt" of the space "Personal" should be "original content" - @issue-10649 + @issue-10331 @issue-10469 Scenario: public uploads a zero byte file to a public share folder Given using SharingNG And user "Alice" has created folder "/uploadFolder" @@ -418,7 +418,7 @@ Feature: upload resources on share using TUS protocol And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: | textfile (1).txt | - @issue-10649 + @issue-10331 @issue-10469 Scenario: public uploads a zero-byte file to a shared folder inside project space Given using SharingNG And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API @@ -426,7 +426,7 @@ Feature: upload resources on share using TUS protocol And user "Alice" has created a folder "/uploadFolder" in space "Project" And user "Alice" has created the following resource link share: | resource | uploadFolder | - | space | Project | + | space | Project | | permissionsRole | createOnly | | password | %public% | When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API @@ -435,7 +435,7 @@ Feature: upload resources on share using TUS protocol And for user "Alice" folder "uploadFolder" of the space "Project" should not contain these files: | textfile (1).txt | - @issue-10649 + @issue-10331 @issue-10469 Scenario: public uploads a zero-byte file to a public share project space Given using SharingNG And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API From cf348c0f6e7d2ec740a7b0baf7338dd55bf80221 Mon Sep 17 00:00:00 2001 From: nabim777 Date: Fri, 13 Dec 2024 15:59:17 +0545 Subject: [PATCH 4/5] review address Signed-off-by: nabim777 --- tests/acceptance/bootstrap/SpacesTUSContext.php | 4 ++-- tests/acceptance/bootstrap/TUSContext.php | 6 +++--- .../features/apiSpacesShares/shareUploadTUS.feature | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/acceptance/bootstrap/SpacesTUSContext.php b/tests/acceptance/bootstrap/SpacesTUSContext.php index 33a87b7bdc7..65e20becda7 100644 --- a/tests/acceptance/bootstrap/SpacesTUSContext.php +++ b/tests/acceptance/bootstrap/SpacesTUSContext.php @@ -96,7 +96,7 @@ public function userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi( } /** - * @When the public uploads a file from :source to :destination via TUS inside last link shared folder with password :password using the WebDAV API + * @When the public uploads file :source to :destination via TUS inside last link shared folder with password :password using the WebDAV API * * @param string $source * @param string $destination @@ -105,7 +105,7 @@ public function userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi( * @return void * @throws Exception */ - public function publicUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi( + public function thePublicUploadsFileViaTusInsideLastSharedFolderWithPasswordUsingTheWebdavApi( string $source, string $destination, string $password diff --git a/tests/acceptance/bootstrap/TUSContext.php b/tests/acceptance/bootstrap/TUSContext.php index f97ee8c82f9..46cf2fc67c7 100644 --- a/tests/acceptance/bootstrap/TUSContext.php +++ b/tests/acceptance/bootstrap/TUSContext.php @@ -352,10 +352,10 @@ public function uploadFileUsingTus( * @return void */ public function publicUploadFileUsingTus( - string $source, - string $destination, + string $source, + string $destination, string $password, - ):void { + ): void { $password = $this->featureContext->getActualPassword($password); if ($this->featureContext->isUsingSharingNG()) { $token = $this->featureContext->shareNgGetLastCreatedLinkShareToken(); diff --git a/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature b/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature index 90cd82e20cc..1df471ddc5b 100644 --- a/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature +++ b/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature @@ -412,7 +412,7 @@ Feature: upload resources on share using TUS protocol | space | Personal | | permissionsRole | createOnly | | password | %public% | - When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API And for user "Alice" folder "uploadFolder" of the space "Personal" should contain these files: | textfile.txt | And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: @@ -429,7 +429,7 @@ Feature: upload resources on share using TUS protocol | space | Project | | permissionsRole | createOnly | | password | %public% | - When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API And for user "Alice" folder "uploadFolder" of the space "Project" should contain these files: | textfile.txt | And for user "Alice" folder "uploadFolder" of the space "Project" should not contain these files: @@ -444,7 +444,7 @@ Feature: upload resources on share using TUS protocol | space | Project | | permissionsRole | createOnly | | password | %public% | - When the public uploads a file from "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API Then for user "Alice" the space "Project" should contain these files: | textfile.txt | And for user "Alice" the space "Project" should not contain these files: From 0a7977cd7bb2906667655bed1c763d4ab88fc1db Mon Sep 17 00:00:00 2001 From: nabim777 Date: Mon, 30 Dec 2024 17:07:34 +0545 Subject: [PATCH 5/5] remove the test for the tus-upload Signed-off-by: nabim777 --- .../acceptance/bootstrap/SpacesTUSContext.php | 19 -------- tests/acceptance/bootstrap/TUSContext.php | 37 --------------- .../expected-failures-without-remotephp.md | 7 +-- .../features/apiSpaces/uploadSpaces.feature | 3 ++ .../apiSpacesShares/shareUploadTUS.feature | 47 ------------------- 5 files changed, 5 insertions(+), 108 deletions(-) diff --git a/tests/acceptance/bootstrap/SpacesTUSContext.php b/tests/acceptance/bootstrap/SpacesTUSContext.php index 65e20becda7..a179244d7ef 100644 --- a/tests/acceptance/bootstrap/SpacesTUSContext.php +++ b/tests/acceptance/bootstrap/SpacesTUSContext.php @@ -95,25 +95,6 @@ public function userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi( $this->featureContext->setLastUploadDeleteTime(\time()); } - /** - * @When the public uploads file :source to :destination via TUS inside last link shared folder with password :password using the WebDAV API - * - * @param string $source - * @param string $destination - * @param string $password - * - * @return void - * @throws Exception - */ - public function thePublicUploadsFileViaTusInsideLastSharedFolderWithPasswordUsingTheWebdavApi( - string $source, - string $destination, - string $password - ): void { - $this->tusContext->publicUploadFileUsingTus($source, $destination, $password); - $this->featureContext->setLastUploadDeleteTime(\time()); - } - /** * @Given user :user has created a new TUS resource in the space :spaceName with the following headers: * diff --git a/tests/acceptance/bootstrap/TUSContext.php b/tests/acceptance/bootstrap/TUSContext.php index 46cf2fc67c7..4d023a0e01c 100644 --- a/tests/acceptance/bootstrap/TUSContext.php +++ b/tests/acceptance/bootstrap/TUSContext.php @@ -344,43 +344,6 @@ public function uploadFileUsingTus( } } - /** - * @param string $source - * @param string $destination - * @param string $password - * - * @return void - */ - public function publicUploadFileUsingTus( - string $source, - string $destination, - string $password, - ): void { - $password = $this->featureContext->getActualPassword($password); - if ($this->featureContext->isUsingSharingNG()) { - $token = $this->featureContext->shareNgGetLastCreatedLinkShareToken(); - } else { - $token = $this->featureContext->getLastCreatedPublicShareToken(); - } - $headers = [ - 'Authorization' => 'Basic ' . \base64_encode("public" . ':' . $password), - ]; - $sourceFile = $this->featureContext->acceptanceTestsDirLocation() . $source; - $url = WebdavHelper::getDavPath(WebDavHelper::DAV_VERSION_SPACES, $token, "public-files"); - - $client = new Client( - $this->featureContext->getBaseUrl(), - [ - 'verify' => false, - 'headers' => $headers - ] - ); - - $client->setApiPath($url); - $client->setKey((string)rand())->file($sourceFile, $destination); - $client->file($sourceFile, $destination)->createWithUpload("", 0); - } - /** * @When user :user uploads file with content :content to :destination using the TUS protocol on the WebDAV API * diff --git a/tests/acceptance/expected-failures-without-remotephp.md b/tests/acceptance/expected-failures-without-remotephp.md index 120d9635765..6aefe6f9dec 100644 --- a/tests/acceptance/expected-failures-without-remotephp.md +++ b/tests/acceptance/expected-failures-without-remotephp.md @@ -196,11 +196,8 @@ - [apiSpaces/publicLink.feature:34](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/publicLink.feature#L34) - [apiSpaces/publicLink.feature:40](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/publicLink.feature#L40) - [apiSpaces/uploadSpaces.feature:98](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L98) -- [apiSpaces/uploadSpaces.feature:114](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L114) -- [apiSpaces/uploadSpaces.feature:130](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L130) -- [apiSpacesShares/shareUploadTUS.feature:407](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L407) -- [apiSpacesShares/shareUploadTUS.feature:422](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L422) -- [apiSpacesShares/shareUploadTUS.feature:439](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L439) +- [apiSpaces/uploadSpaces.feature:115](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L115) +- [apiSpaces/uploadSpaces.feature:132](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L132) - [apiSpacesShares/shareSpacesViaLink.feature:61](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature#L61) - [apiDepthInfinity/propfind.feature:74](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiDepthInfinity/propfind.feature#L74) - [apiDepthInfinity/propfind.feature:124](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiDepthInfinity/propfind.feature#L124) diff --git a/tests/acceptance/features/apiSpaces/uploadSpaces.feature b/tests/acceptance/features/apiSpaces/uploadSpaces.feature index 82bc6ac0ba8..65821a4ef36 100644 --- a/tests/acceptance/features/apiSpaces/uploadSpaces.feature +++ b/tests/acceptance/features/apiSpaces/uploadSpaces.feature @@ -109,6 +109,7 @@ Feature: Upload files into a space | textfile.txt | And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: | textfile (1).txt | + | textfile (2).txt | @issue-10331 @issue-10469 Scenario: public uploads a zero byte file to a public share folder inside project space @@ -125,6 +126,7 @@ Feature: Upload files into a space | textfile.txt | And for user "Alice" folder "uploadFolder" of the space "Project Ceres" should not contain these files: | textfile (1).txt | + | textfile (2).txt | @issue-10331 @issue-10469 Scenario: public uploads a zero byte file to a public share project space @@ -139,3 +141,4 @@ Feature: Upload files into a space | textfile.txt | And for user "Alice" the space "Project Ceres" should not contain these files: | textfile (1).txt | + | textfile (2).txt | diff --git a/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature b/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature index 1df471ddc5b..e17dcc24e83 100644 --- a/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature +++ b/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature @@ -402,50 +402,3 @@ Feature: upload resources on share using TUS protocol | Tus-Resumable | 1.0.0 | Then the HTTP status code should be "460" And for user "Alice" the content of the file "/textFile.txt" of the space "Personal" should be "original content" - - @issue-10331 @issue-10469 - Scenario: public uploads a zero byte file to a public share folder - Given using SharingNG - And user "Alice" has created folder "/uploadFolder" - And user "Alice" has created the following resource link share: - | resource | uploadFolder | - | space | Personal | - | permissionsRole | createOnly | - | password | %public% | - When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API - And for user "Alice" folder "uploadFolder" of the space "Personal" should contain these files: - | textfile.txt | - And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: - | textfile (1).txt | - - @issue-10331 @issue-10469 - Scenario: public uploads a zero-byte file to a shared folder inside project space - Given using SharingNG - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "Project" with the default quota using the Graph API - And user "Alice" has created a folder "/uploadFolder" in space "Project" - And user "Alice" has created the following resource link share: - | resource | uploadFolder | - | space | Project | - | permissionsRole | createOnly | - | password | %public% | - When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API - And for user "Alice" folder "uploadFolder" of the space "Project" should contain these files: - | textfile.txt | - And for user "Alice" folder "uploadFolder" of the space "Project" should not contain these files: - | textfile (1).txt | - - @issue-10331 @issue-10469 - Scenario: public uploads a zero-byte file to a public share project space - Given using SharingNG - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "Project" with the default quota using the Graph API - And user "Alice" has created the following space link share: - | space | Project | - | permissionsRole | createOnly | - | password | %public% | - When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" via TUS inside last link shared folder with password "%public%" using the WebDAV API - Then for user "Alice" the space "Project" should contain these files: - | textfile.txt | - And for user "Alice" the space "Project" should not contain these files: - | textfile (1).txt |