Skip to content

Commit

Permalink
address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
SwikritiT committed Aug 26, 2022
1 parent 4c3bdd3 commit 75667e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions tests/acceptance/features/apiSpaces/tusUpload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Feature: upload resources using TUS protocol
And for user "Alice" the space "Project Jupiter" should contain these entries:
| lorem.txt |


Scenario: upload a file bigger than the set quota to a project space
Given user "Alice" has created a space "Project Jupiter" of type "project" with quota "10"
When user "Alice" creates a new TUS resource "lorem.txt" for the space "Project Jupiter" using the WebDAV API
Expand Down
9 changes: 3 additions & 6 deletions tests/acceptance/features/bootstrap/TusContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ public function before(BeforeScenarioScope $scope): void {
* @throws GuzzleException
*/
public function uploadFileViaTus(string $user, string $resource, string $spaceName): void {
$this->createTusResource($user, $resource, $spaceName);
$this->featureContext->theHTTPStatusCodeShouldBe(201, "Expected response status code should be 201");
$this->uploadResourceThroughTUS($user, $resource);
userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi($user, $resource, $spaceName);
$this->featureContext->theHTTPStatusCodeShouldBe(204, "Expected response status code should be 204");
}

Expand Down Expand Up @@ -128,11 +126,10 @@ public function createTusResource(string $user, string $resource, string $spaceN

$tusEndpoint = "tusEndpoint " . base64_encode(str_replace("$", "%", $fullUrl));
$fileName = "filename " . base64_encode($resource);

$headers = [
"Tus-Resumable" => "1.0.0",
"Upload-Metadata" => $tusEndpoint . ',' . $fileName,
"Upload-Length" => filesize($this->acceptanceTestsDirLocation() . $resource)
"Upload-Length" => filesize($this->featureContext->acceptanceTestsDirLocation() . 'filesForUpload/' . $resource)
];
$this->featureContext->setResponse(
HttpRequestHelper::post(
Expand All @@ -153,7 +150,7 @@ public function uploadResourceThroughTUS(string $user, string $resource) {
} else {
throw new \Exception(__METHOD__ . " Location header could not be found");
}
$file = \fopen($this->acceptanceTestsDirLocation() . $resource, 'r');
$file = \fopen($this->featureContext->acceptanceTestsDirLocation() . 'filesForUpload/' . $resource, 'r');

$this->featureContext->setResponse(
HttpRequestHelper::sendRequest(
Expand Down

0 comments on commit 75667e6

Please sign in to comment.