[test-only] add test for uploading with Tus using CORS (#8508)

* add test for uploading with Tus using CORS

* fix
This commit is contained in:
Viktor Scharf
2024-02-23 11:47:52 +01:00
committed by GitHub
parent 3cea035d6d
commit ad7cf8f77a
4 changed files with 70 additions and 7 deletions
@@ -286,6 +286,29 @@ class SpacesTUSContext implements Context {
$this->tusContext->userUploadsChunkFileWithChecksum($user, $offset, $data, $checksum);
}
/**
* @When /^user "([^"]*)" sends a chunk to the last created TUS Location with data "([^"]*)" inside of the space "([^"]*)" with headers:$/
*
* @param string $user
* @param string $data
* @param string $spaceName
* @param TableNode $headers
*
* @return void
* @throws Exception|GuzzleException
*/
public function userSendsAChunkToTheLastCreatedTusLocationWithDataInsideOfTheSpaceWithHeaders(
string $user,
string $data,
string $spaceName,
TableNode $headers
): void {
$this->spacesContext->setSpaceIDByName($user, $spaceName);
$rows = $headers->getRowsHash();
$response = $this->tusContext->sendsAChunkToTUSLocationWithOffsetAndData($user, $rows['Upload-Offset'], $data, $rows['Upload-Checksum'], ['Origin' => $rows['Origin']]);
$this->featureContext->setResponse($response);
}
/**
* @When /^user "([^"]*)" overwrites recently shared file with offset "([^"]*)" and data "([^"]*)" with checksum "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API with these headers:$/
*