Skip to content

Commit

Permalink
[tests-only] [full-ci] removing the setresponse in given/then step in…
Browse files Browse the repository at this point in the history
… spacestus context (#7447)

* refactored removing setting response in given/then steps in spacetus context

* adressing reviews
  • Loading branch information
KarunAtreya authored Oct 12, 2023
1 parent 67cfcab commit 79a4e3d
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tests/acceptance/features/bootstrap/SpacesTUSContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function before(BeforeScenarioScope $scope): void {
* @throws GuzzleException
*/
public function userHasUploadedFileViaTusInSpace(string $user, string $source, string $destination, string $spaceName): void {
$this->userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi($user, $source, $destination, $spaceName);
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Expected response status code should be 200");
$this->spacesContext->setSpaceIDByName($user, $spaceName);
$this->tusContext->userUploadsUsingTusAFileTo($user, $source, $destination);
}

/**
Expand Down Expand Up @@ -102,8 +102,9 @@ public function userHasCreatedANewTusResourceForTheSpaceUsingTheWebdavApiWithThe
string $content,
TableNode $headers
): void {
$this->userCreatesANewTusResourceForTheSpaceUsingTheWebdavApiWithTheseHeaders($user, $spaceName, $content, $headers);
$this->featureContext->theHTTPStatusCodeShouldBe(201, "Expected response status code should be 201");
$this->spacesContext->setSpaceIDByName($user, $spaceName);
$response = $this->tusContext->createNewTUSResourceWithHeaders($user, $headers, $content);
$this->featureContext->theHTTPStatusCodeShouldBe(201, "Expected response status code should be 201", $response);
}

/**
Expand Down Expand Up @@ -152,7 +153,7 @@ public function userUploadsAFileWithContentToViaTusInsideOfTheSpaceUsingTheWebda
}

/**
* @When /^user "([^"]*)" has uploaded a file with content "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)"$/
* @Given /^user "([^"]*)" has uploaded a file with content "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)"$/
*
* @param string $user
* @param string $content
Expand All @@ -169,10 +170,6 @@ public function userHasUploadedAFileWithContentToViaTusInsideOfTheSpace(
string $spaceName
): void {
$this->userUploadsAFileWithContentToViaTusInsideOfTheSpaceUsingTheWebdavApi($user, $content, $resource, $spaceName);
$this->featureContext->theHTTPStatusCodeShouldBe(
200,
"Expected response status code should be 200"
);
}

/**
Expand Down Expand Up @@ -243,7 +240,7 @@ public function userHasUploadedFileWithChecksumToTheLastCreatedTusLocationWithOf
}

/**
* @Given /^user "([^"]*)" uploads file with checksum "([^"]*)" to the last created TUS Location with offset "([^"]*)" and content "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
* @When /^user "([^"]*)" uploads file with checksum "([^"]*)" to the last created TUS Location with offset "([^"]*)" and content "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
*
* @param string $user
* @param string $checksum
Expand All @@ -262,7 +259,8 @@ public function userUploadsFileWithChecksumToTheLastCreatedTusLocationWithOffset
string $spaceName
): void {
$this->spacesContext->setSpaceIDByName($user, $spaceName);
$this->tusContext->userUploadsFileWithChecksum($user, $checksum, $offset, $content);
$response = $this->tusContext->sendsAChunkToTUSLocationWithOffsetAndData($user, $offset, $content, $checksum);
$this->featureContext->setResponse($response);
}

/**
Expand Down

0 comments on commit 79a4e3d

Please sign in to comment.