Merge pull request #4373 from owncloud/addTestForCopyForSharesJailOnOcis
[tests-only][full-ci]Add `/Shares` related copy tests on ocis which are removed from core
This commit is contained in:
@@ -316,6 +316,29 @@ class SpacesContext implements Context {
|
||||
return $this->featureContext->getResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a file using user password
|
||||
*
|
||||
* @param string $fullUrl
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function downloadFileAsUserUsingPassword(
|
||||
string $fullUrl,
|
||||
string $user
|
||||
):void {
|
||||
$this->featureContext->setResponse(
|
||||
HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
$this->featureContext->getStepLineRef(),
|
||||
'GET',
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The method returns fileId
|
||||
*
|
||||
@@ -1874,6 +1897,39 @@ class SpacesContext implements Context {
|
||||
$this->copyFilesAndFoldersRequest($user, $fullUrl, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should not be able to download file "([^"]*)" from space "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileName
|
||||
* @param string $spaceName
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userShouldNotBeAbleToDownloadFileInsideSpace(
|
||||
string $user,
|
||||
string $fileName,
|
||||
string $spaceName
|
||||
):void {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($fileName, "/");
|
||||
$this->downloadFileAsUserUsingPassword($fullUrl, $user);
|
||||
Assert::assertGreaterThanOrEqual(
|
||||
400,
|
||||
$this->featureContext->getResponse()->getStatusCode(),
|
||||
__METHOD__
|
||||
. ' download must fail'
|
||||
);
|
||||
Assert::assertLessThanOrEqual(
|
||||
499,
|
||||
$this->featureContext->getResponse()->getStatusCode(),
|
||||
__METHOD__
|
||||
. ' 4xx error expected but got status code "'
|
||||
. $this->featureContext->getResponse()->getStatusCode() . '"'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" moves (?:file|folder) "([^"]*)" from space "([^"]*)" to "([^"]*)" inside space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user