Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] Backport refactor spacestus context removing setresponse in given/then step #7481

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -224,7 +221,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 @@ -243,7 +240,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