Merge pull request #9338 from owncloud/fixTestPublicDownloadFile

[test-only] fix tests where public try to download file
This commit is contained in:
Viktor Scharf
2024-06-11 13:44:05 +02:00
committed by GitHub
3 changed files with 5 additions and 67 deletions

View File

@@ -88,10 +88,6 @@ cannot share a folder with create permission
- [coreApiShareManagementBasicToShares/deleteShareFromShares.feature:155](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature#L155)
- [coreApiShareManagementBasicToShares/deleteShareFromShares.feature:172](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature#L172)
#### [Public link enforce permissions](https://github.com/owncloud/ocis/issues/1269)
- [coreApiSharePublicLink1/createPublicLinkShare.feature:290](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L290)
#### [copying a folder within a public link folder to folder with same name as an already existing file overwrites the parent file](https://github.com/owncloud/ocis/issues/1232)
- [coreApiSharePublicLink2/copyFromPublicLink.feature:75](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L75)
@@ -155,8 +151,6 @@ API, search, favorites, config, capabilities, not existing endpoints, CORS and o
- [coreApiAuth/ocsGETAuth.feature:123](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/ocsGETAuth.feature#L123)
- [coreApiAuth/ocsPOSTAuth.feature:10](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/ocsPOSTAuth.feature#L10)
- [coreApiAuth/ocsPUTAuth.feature:7](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/ocsPUTAuth.feature#L7)
- [coreApiSharePublicLink1/createPublicLinkShare.feature:277](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L277)
#### [sending MKCOL requests to another or non-existing user's webDav endpoints as normal user should return 404](https://github.com/owncloud/ocis/issues/5049)
_ocdav: api compatibility, return correct status code_

View File

@@ -64,30 +64,6 @@ class PublicWebDavContext implements Context {
);
}
/**
* @When /^the public downloads the last public link shared file with range "([^"]*)" and password "([^"]*)" using the (old|new) public WebDAV API$/
*
* @param string $range ignore if empty
* @param string $password
* @param string $publicWebDAVAPIVersion
*
* @return void
*/
public function downloadPublicFileWithRangeAndPassword(string $range, string $password, string $publicWebDAVAPIVersion):void {
if ($publicWebDAVAPIVersion === "new") {
$path = (string) $this->featureContext->getLastCreatedPublicShare()->file_target;
} else {
$path = "";
}
$response = $this->downloadFileFromPublicFolder(
$path,
$password,
$range,
$publicWebDAVAPIVersion
);
$this->featureContext->setResponse($response);
}
/**
* @When /^the public downloads the last public link shared file using the (old|new) public WebDAV API$/
* @When /^the public tries to download the last public link shared file using the (old|new) public WebDAV API$/
@@ -292,6 +268,7 @@ class PublicWebDavContext implements Context {
/**
* @When /^the public downloads file "([^"]*)" from inside the last public link shared folder with password "([^"]*)" using the (old|new) public WebDAV API$/
* @When /^the public tries to download file "([^"]*)" from inside the last public link shared folder with password "([^"]*)" using the (old|new) public WebDAV API$/
*
* @param string $path
* @param string $password
@@ -1215,37 +1192,6 @@ class PublicWebDavContext implements Context {
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
}
/**
* @Then /^the public should be able to download the range "([^"]*)" of file "([^"]*)" from inside the last public link shared folder using the (old|new) public WebDAV API and the content should be "([^"]*)"$/
*
* @param string $range
* @param string $path
* @param string $publicWebDAVAPIVersion
* @param string $content
*
* @return void
* @throws Exception
*/
public function shouldBeAbleToDownloadRangeOfFileInsidePublicSharedFolder(
string $range,
string $path,
string $publicWebDAVAPIVersion,
string $content
):void {
if ($publicWebDAVAPIVersion === "old") {
return;
}
$response = $this->downloadFileFromPublicFolder(
$path,
'',
$range,
$publicWebDAVAPIVersion
);
$this->featureContext->checkDownloadedContentMatches($content, "", $response);
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
}
/**
* @Then /^the public upload to the last publicly shared file using the (old|new) public WebDAV API with password "([^"]*)" should (?:fail|pass) with HTTP status code "([^"]*)"$/
*
@@ -1279,7 +1225,6 @@ class PublicWebDavContext implements Context {
}
/**
* @Then /^uploading a file should not work using the (old|new) public WebDAV API$/
* @Then /^the public upload to the last publicly shared folder using the (old|new) public WebDAV API should fail with HTTP status code "([^"]*)"$/
*
* @param string $publicWebDAVAPIVersion
@@ -1312,7 +1257,6 @@ class PublicWebDavContext implements Context {
}
/**
* @Then /^uploading a file should not work using the (old|new) public WebDAV API with password "([^"]*)"$/
* @Then /^the public upload to the last publicly shared folder using the (old|new) public WebDAV API with password "([^"]*)" should fail with HTTP status code "([^"]*)"$/
*
* @param string $publicWebDAVAPIVersion

View File

@@ -284,7 +284,8 @@ Feature: create a public link share
| permissionsRole | view |
| password | %public% |
When user "Alice" deletes folder "/PARENT" using the WebDAV API
Then the public download of file "/parent.txt" from inside the last public link shared folder using the new public WebDAV API with password "%public%" should fail with HTTP status code "404"
And the public tries to download file "/parent.txt" from inside the last public link shared folder with password "%public%" using the new public WebDAV API
Then the HTTP status code should be "404"
@issue-1269 @issue-1293 @skipOnReva
Scenario: try to download from a public share that has upload only permissions using the public webdav api
@@ -296,9 +297,8 @@ Feature: create a public link share
| space | Personal |
| permissionsRole | createOnly |
| password | %public% |
When the public downloads file "parent.txt" from inside the last public link shared folder using the new public WebDAV API
Then the value of the item "//s:message" in the response should be "File not found: parent.txt"
And the HTTP status code should be "404"
When the public tries to download file "/parent.txt" from inside the last public link shared folder with password "%public%" using the new public WebDAV API
Then the HTTP status code should be "403"
@env-config @skipOnReva
Scenario: get the size of a file shared by public link