Skip to content

Commit

Permalink
addressed the reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
KarunAtreya committed Sep 21, 2023
1 parent 370f730 commit 5c900e3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
11 changes: 9 additions & 2 deletions tests/acceptance/features/bootstrap/SettingsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,13 @@ public function sendRequestToSwitchSystemLanguage(string $user, string $language
],
JSON_THROW_ON_ERROR
);
return $this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body, $this->featureContext->getStepLineRef());
return $this->spacesContext->sendPostRequestToUrl(
$fullUrl,
$user,
$this->featureContext->getPasswordForUser($user),
$body,
$this->featureContext->getStepLineRef()
);
}

/**
Expand All @@ -405,10 +411,11 @@ public function sendRequestToSwitchSystemLanguage(string $user, string $language
* @throws GuzzleException
*/
public function theUserHasSwitchedSystemLanguage(string $user, string $language): void {
$response = $this->sendRequestToSwitchSystemLanguage($user, $language);
$this->featureContext->theHTTPStatusCodeShouldBe(
201,
"Expected response status code should be 201",
$this->sendRequestToSwitchSystemLanguage($user, $language)
$response
);
}
}
14 changes: 6 additions & 8 deletions tests/acceptance/features/bootstrap/TUSContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function userCreateNewTUSResourceWithHeaders(string $user, TableNode $hea
* @throws Exception
* @throws GuzzleException
*/
public function createNewTUSResource(string $user, TableNode $headers): void {
public function userHasCreatedNewTUSResourceWithHeaders(string $user, TableNode $headers): void {
$rows = $headers->getRows();
$rows[] = ['Tus-Resumable', '1.0.0'];
$response = $this->createNewTUSResourceWithHeaders($user, new TableNode($rows));
Expand All @@ -125,7 +125,7 @@ public function createNewTUSResource(string $user, TableNode $headers): void {
public function sendsAChunkToTUSLocationWithOffsetAndData(string $user, string $offset, string $data, string $checksum = ''): ResponseInterface {
$user = $this->featureContext->getActualUsername($user);
$password = $this->featureContext->getUserPassword($user);
$response = HttpRequestHelper::sendRequest(
return HttpRequestHelper::sendRequest(
$this->resourceLocation,
$this->featureContext->getStepLineRef(),
'PATCH',
Expand All @@ -139,24 +139,22 @@ public function sendsAChunkToTUSLocationWithOffsetAndData(string $user, string $
],
$data
);
return $response;
}

/**
* @When /^user "([^"]*)" sends a chunk to the last created TUS Location with offset "([^"]*)" and data "([^"]*)" using the WebDAV API$/
* @When user :user sends a chunk to the last created TUS Location with offset :offset and data :data using the WebDAV API
*
* @param string $user
* @param string $offset
* @param string $data
* @param string $checksum
*
* @return void
*
* @throws GuzzleException
* @throws JsonException
*/
public function userSendsAChunkToTUSLocationWithOffsetAndData(string $user, string $offset, string $data, string $checksum = ''): void {
$response = $this->sendsAChunkToTUSLocationWithOffsetAndData($user, $offset, $data, $checksum);
public function userSendsAChunkToTUSLocationWithOffsetAndData(string $user, string $offset, string $data): void {
$response = $this->sendsAChunkToTUSLocationWithOffsetAndData($user, $offset, $data);
$this->featureContext->setResponse($response);
WebDavHelper::$SPACE_ID_FROM_OCIS = '';
}
Expand Down Expand Up @@ -511,7 +509,7 @@ public function userHasUploadedChunkFileWithChecksum(string $user, string $offse
* @throws Exception
*/
public function userOverwritesFileWithChecksum(string $user, string $offset, string $data, string $checksum, TableNode $headers): void {
$this->createNewTUSResource($user, $headers);
$this->userHasCreatedNewTUSResourceWithHeaders($user, $headers);
$response = $this->sendsAChunkToTUSLocationWithOffsetAndData($user, $offset, $data, $checksum);
$this->featureContext->setResponse($response);
}
Expand Down

0 comments on commit 5c900e3

Please sign in to comment.