Adds tests for sending PATCH request to other user's space

Signed-off-by: Swikriti Tripathi <swikriti808@gmail.com>
This commit is contained in:
Swikriti Tripathi
2023-01-05 07:42:32 +05:45
committed by Phil Davis
parent 290a4886a1
commit 6a4ee395bf
3 changed files with 42 additions and 2 deletions
@@ -753,6 +753,36 @@ class SpacesContext implements Context {
);
}
/**
* @When /^user "([^"]*)" sends PATCH request to the space "([^"]*)" of user "([^"]*)" with data "([^"]*)"$/
*
* @param string $user
* @param string $spaceName
* @param string $owner
* @param string $data
*
* @return void
* @throws GuzzleException
*/
public function userSendsPatchRequestToTheSpaceOfUserWithData(string $user, string $spaceName, string $owner, string $data): void {
$space = $this->getSpaceByName($owner, $spaceName);
Assert::assertIsArray($space);
Assert::assertNotEmpty($spaceId = $space["id"]);
Assert::assertNotEmpty($space["root"]["webDavUrl"]);
$url = GraphHelper::getFullUrl($this->featureContext->getBaseUrl(), 'drives/' . $spaceId);
$this->featureContext->setResponse(
HttpRequestHelper::sendRequest(
$url,
"",
"PATCH",
$this->featureContext->getActualUsername($user),
$this->featureContext->getPasswordForUser($user),
null,
$data
)
);
}
/**
* @Then /^the (?:propfind|search) result of the space should (not|)\s?contain these (?:files|entries):$/
*