upload file after renaming

This commit is contained in:
Viktor Scharf
2023-05-24 17:12:19 +02:00
parent 9f2500eba1
commit d271a19459
3 changed files with 34 additions and 1 deletions

View File

@@ -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 |

View File

@@ -1587,6 +1587,7 @@ class SpacesContext implements Context {
$fileDestination,
$spaceName
);
$headers['Overwrite'] = 'F';
$fileSource = $this->escapePath(\trim($fileSource, "/"));
$fullUrl = $space["root"]["webDavUrl"] . '/' . $fileSource;

View File

@@ -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$/
*