Skip to content

Commit

Permalink
adds status check on given steps of tus upload
Browse files Browse the repository at this point in the history
Signed-off-by: nabim777 <[email protected]>
  • Loading branch information
nabim777 committed Jan 7, 2025
1 parent 444ddb3 commit abcb354
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/acceptance/TestHelpers/TusClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function uploadWithResponse(int $bytes = -1): ResponseInterface {
throw new TusException('Upload expired.');
}

$data = $this->getData($offset, $bytes);
$data = $this->getData($offset, $bytes);
$headers = $this->headers + [
'Content-Type' => self::HEADER_CONTENT_TYPE,
'Content-Length' => \strlen($data),
Expand Down
14 changes: 12 additions & 2 deletions tests/acceptance/bootstrap/SpacesTUSContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ public function userHasUploadedFileViaTusInSpace(
string $spaceName
): void {
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
$this->tusContext->uploadFileUsingTus($user, $source, $destination, $spaceId);
$response = $this->tusContext->uploadFileUsingTus($user, $source, $destination, $spaceId);
$this->featureContext->setLastUploadDeleteTime(\time());
$this->featureContext->theHTTPStatusCodeShouldBe(
["201", "204"],
"HTTP status code was not 201 or 204 while trying to upload file '$destination' for user '$user'",
$response
);
}

/**
Expand Down Expand Up @@ -259,7 +264,12 @@ public function userHasUploadedAFileWithContentToViaTusInsideOfTheSpace(
string $resource,
string $spaceName
): void {
$this->uploadFileViaTus($user, $content, $resource, $spaceName);
$response = $this->uploadFileViaTus($user, $content, $resource, $spaceName);
$this->featureContext->theHTTPStatusCodeShouldBe(
["201", "204"],
"HTTP status code was not 201 or 204 while trying to upload file '$resource' for user '$user'",
$response
);
}

/**
Expand Down

0 comments on commit abcb354

Please sign in to comment.