accessToPublicLinkShare.feature: Used sharingNG for sharing in given step

This commit is contained in:
Prarup Gurung
2024-05-15 17:50:45 +05:45
parent b9dcc1bee8
commit b0ec3008b9
4 changed files with 33 additions and 27 deletions
+1
View File
@@ -136,6 +136,7 @@ default:
- TrashbinContext:
- WebDavPropertiesContext:
- OcisConfigContext:
- SharingNgContext:
coreApiSharePublicLink2:
paths:
@@ -332,17 +332,12 @@ class PublicWebDavContext implements Context {
/**
* @param string $path
* @param string $user
* @param bool $shareNg
*
* @return ResponseInterface
*/
public function downloadFromPublicLinkAsUser(string $path, string $user, bool $shareNg = false): ResponseInterface {
public function downloadFromPublicLinkAsUser(string $path, string $user): ResponseInterface {
$path = \ltrim($path, "/");
if ($shareNg) {
$token = $this->featureContext->shareNgGetLastCreatedLinkShareToken();
} else {
$token = $this->featureContext->getLastCreatedPublicShareToken();
}
$token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken();
$davPath = WebDavHelper::getDavPath(
$token,
@@ -3245,7 +3245,7 @@ trait Sharing {
* @return void
*/
public function thePublicAccessesThePreviewOfTheSharedFileUsingTheSharingApi(string $path):void {
$token = $this->getLastCreatedPublicShareToken();
$token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken();
$this->getPublicPreviewOfFile($path, $token);
$this->pushToLastStatusCodesArrays();
}
@@ -3266,7 +3266,7 @@ trait Sharing {
$this->emptyLastHTTPStatusCodesArray();
$this->emptyLastOCSStatusCodesArray();
foreach ($paths as $path) {
$token = $this->getLastCreatedPublicShareToken();
$token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken();
$this->getPublicPreviewOfFile($path["path"], $token);
$this->pushToLastStatusCodesArrays();
}
@@ -11,10 +11,12 @@ Feature: accessing a public link share
Scenario: access to the preview of password protected public link without providing the password is not allowed
Given user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "testavatar.jpg"
And user "Alice" has created a public link share with settings
| path | /testavatar.jpg |
| permissions | change |
| password | %public% |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | testavatar.jpg |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public accesses the preview of file "testavatar.jpg" from the last shared public link using the sharing API
Then the HTTP status code should be "404"
@@ -22,9 +24,11 @@ Feature: accessing a public link share
Scenario: access to the preview of public shared file without password
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false"
And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "testavatar.jpg"
And user "Alice" has created a public link share with settings
| path | /testavatar.jpg |
| permissions | change |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | testavatar.jpg |
| space | Personal |
| permissionsRole | edit |
When the public accesses the preview of file "testavatar.jpg" from the last shared public link using the sharing API
Then the HTTP status code should be "200"
@@ -33,10 +37,12 @@ Feature: accessing a public link share
Given user "Alice" has created folder "FOLDER"
And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "FOLDER/testavatar.jpg"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "FOLDER/textfile0.txt"
And user "Alice" has created a public link share with settings
| path | /FOLDER |
| permissions | change |
| password | %public% |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | FOLDER |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public accesses the preview of the following files from the last shared public link using the sharing API
| path |
| testavatar.jpg |
@@ -49,9 +55,11 @@ Feature: accessing a public link share
And user "Alice" has created folder "FOLDER"
And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "FOLDER/testavatar.jpg"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "FOLDER/textfile0.txt"
And user "Alice" has created a public link share with settings
| path | /FOLDER |
| permissions | change |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | FOLDER |
| space | Personal |
| permissionsRole | edit |
When the public accesses the preview of the following files from the last shared public link using the sharing API
| path |
| testavatar.jpg |
@@ -62,9 +70,11 @@ Feature: accessing a public link share
Scenario: user tries to download public link file using own basic auth
And user "Alice" has created folder "FOLDER"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "FOLDER/textfile.txt"
And user "Alice" has created a public link share with settings
| path | FOLDER |
| permissions | change |
| password | %public% |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | FOLDER |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When user "Alice" tries to download file "textfile.txt" from the last public link using own basic auth and new public WebDAV API
Then the HTTP status code should be "401"