diff --git a/tests/acceptance/features/apiSpaces/tusUpload.feature b/tests/acceptance/features/apiSpaces/tusUpload.feature index 37546e7c7b..4c12bce018 100644 --- a/tests/acceptance/features/apiSpaces/tusUpload.feature +++ b/tests/acceptance/features/apiSpaces/tusUpload.feature @@ -1,4 +1,4 @@ -@api +@api Feature: upload resources using TUS protocol As a user I want to be able to upload files @@ -32,3 +32,11 @@ Feature: upload resources using TUS protocol And for user "Alice" the space "Project Jupiter" should not contain these entries: | upload.txt | + + Scenario: upload the same file after renaming the first one + Given user "Alice" has uploaded a file with content "uploaded content" to "/upload.txt" via TUS inside of the space "Alice Hansen" + And user "Alice" has moved file "upload.txt" to "test.txt" in space "Alice Hansen" + When user "Alice" uploads a file with content "uploaded content" to "/upload.txt" via TUS inside of the space "Alice Hansen" using the WebDAV API + Then for user "Alice" the space "Alice Hansen" should contain these entries: + | test.txt | + | upload.txt | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 3d04897f00..3b7c2d09d0 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -1587,6 +1587,7 @@ class SpacesContext implements Context { $fileDestination, $spaceName ); + $headers['Overwrite'] = 'F'; $fileSource = $this->escapePath(\trim($fileSource, "/")); $fullUrl = $space["root"]["webDavUrl"] . '/' . $fileSource; diff --git a/tests/acceptance/features/bootstrap/SpacesTUSContext.php b/tests/acceptance/features/bootstrap/SpacesTUSContext.php index 32f91fa038..9b53a03454 100644 --- a/tests/acceptance/features/bootstrap/SpacesTUSContext.php +++ b/tests/acceptance/features/bootstrap/SpacesTUSContext.php @@ -150,6 +150,30 @@ class SpacesTUSContext implements Context { $this->tusContext->userUploadsAFileWithContentToUsingTus($user, $content, $resource); } + /** + * @When /^user "([^"]*)" has uploaded a file with content "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)"$/ + * + * @param string $user + * @param string $content + * @param string $resource + * @param string $spaceName + * + * @return void + * @throws Exception|GuzzleException + */ + public function userHasUploadedAFileWithContentToViaTusInsideOfTheSpace( + string $user, + string $content, + string $resource, + string $spaceName + ): void { + $this->userUploadsAFileWithContentToViaTusInsideOfTheSpaceUsingTheWebdavApi($user, $content, $resource, $spaceName); + $this->featureContext->theHTTPStatusCodeShouldBe( + 200, + "Expected response status code should be 200" + ); + } + /** * @When /^user "([^"]*)" uploads a file "([^"]*)" to "([^"]*)" with mtime "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/ *