refactored removing setting response in given/then steps in spacetus context (#7481)

adressing reviews
This commit is contained in:
Karun Atreya
2023-10-13 12:48:57 +05:45
committed by GitHub
parent c80a949415
commit d26d6689b0

View File

@@ -57,8 +57,8 @@ class SpacesTUSContext implements Context {
* @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);
}
/**
@@ -102,8 +102,9 @@ class SpacesTUSContext implements Context {
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);
}
/**
@@ -152,7 +153,7 @@ class SpacesTUSContext implements Context {
}
/**
* @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
@@ -169,10 +170,6 @@ class SpacesTUSContext implements Context {
string $spaceName
): void {
$this->userUploadsAFileWithContentToViaTusInsideOfTheSpaceUsingTheWebdavApi($user, $content, $resource, $spaceName);
$this->featureContext->theHTTPStatusCodeShouldBe(
200,
"Expected response status code should be 200"
);
}
/**
@@ -224,7 +221,7 @@ class SpacesTUSContext implements Context {
}
/**
* @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
@@ -243,7 +240,8 @@ class SpacesTUSContext implements Context {
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);
}
/**