Merge pull request #9207 from owncloud/use-sharingNG-in-given-steps-coreApiWebdavOperations

[full-ci] [tests-only] Use sharing-ng in given steps for sharing
This commit is contained in:
Prarup Gurung
2024-05-20 16:19:42 +05:45
committed by GitHub
5 changed files with 34 additions and 23 deletions

View File

@@ -253,6 +253,7 @@ default:
- FeatureContext: *common_feature_context_params
- SearchContext:
- PublicWebDavContext:
- SharingNgContext:
- WebDavPropertiesContext:
- TrashbinContext:
- OcisConfigContext:

View File

@@ -1871,7 +1871,7 @@ class PublicWebDavContext implements Context {
} else {
$body = null;
}
$token = $this->featureContext->getLastCreatedPublicShareToken();
$token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken();
$davPath = WebDavHelper::getDavPath(
null,
null,

View File

@@ -5463,16 +5463,12 @@ trait WebDav {
* @throws Exception
*/
public function theLastPublicDavResponseShouldContainTheseNodes(TableNode $table):void {
if ($this->isUsingSharingNG()) {
$user = $this->shareNgGetLastCreatedLinkShareToken();
} else {
$user = $this->getLastCreatedPublicShareToken();
}
$token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken();
$this->verifyTableNodeColumns($table, ["name"]);
$type = $this->usingOldDavPath ? "public-files" : "public-files-new";
foreach ($table->getHash() as $row) {
$path = $this->substituteInLineCodes($row['name']);
$res = $this->findEntryFromPropfindResponse($path, $user, $type);
$res = $this->findEntryFromPropfindResponse($path, $token, $type);
Assert::assertNotFalse($res, "expected $path to be in DAV response but was not found");
}
}
@@ -5486,12 +5482,12 @@ trait WebDav {
* @throws Exception
*/
public function theLastPublicDavResponseShouldNotContainTheseNodes(TableNode $table):void {
$user = $this->getLastCreatedPublicShareToken();
$token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken();
$this->verifyTableNodeColumns($table, ["name"]);
$type = $this->usingOldDavPath ? "public-files" : "public-files-new";
foreach ($table->getHash() as $row) {
$path = $this->substituteInLineCodes($row['name']);
$res = $this->findEntryFromPropfindResponse($path, $user, $type);
$res = $this->findEntryFromPropfindResponse($path, $token, $type);
Assert::assertFalse($res, "expected $path to not be in DAV response but was found");
}
}

View File

@@ -132,7 +132,11 @@ Feature: list files
| path |
| /simple-folder/simple-folder1/simple-folder2/simple-folder3 |
| /simple-folder/simple-folder1/simple-folder2/simple-folder3/simple-folder4 |
And user "Alice" has created a public link share of folder "simple-folder"
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | simple-folder |
| space | Personal |
| permissionsRole | view |
When the public lists the resources in the last created public link with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the last public link DAV response should not contain these nodes
@@ -156,7 +160,11 @@ Feature: list files
| path |
| /simple-folder/simple-folder1/simple-folder2/simple-folder3 |
| /simple-folder/simple-folder1/simple-folder2/simple-folder3/simple-folder4 |
And user "Alice" has created a public link share of folder "simple-folder"
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | simple-folder |
| space | Personal |
| permissionsRole | view |
When the public lists the resources in the last created public link with depth "1" using the WebDAV API
Then the HTTP status code should be "207"
And the last public link DAV response should contain these nodes

View File

@@ -48,10 +48,12 @@ Feature: PROPFIND
Scenario: send PROPFIND request to a public link shared with password
Given user "Alice" has been created with default attributes and without skeleton files
And user "Alice" has created folder "/PARENT"
And user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | read |
| password | %public% |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | view |
| password | %public% |
When the public sends "PROPFIND" request to the last public link share using the new public WebDAV API with password "%public%"
Then the HTTP status code should be "207"
And the value of the item "//d:href" in the response should match "/%base_path%\/remote.php\/dav\/public-files\/%public_token%\/$/"
@@ -61,10 +63,12 @@ Feature: PROPFIND
Scenario: send PROPFIND request to a public link shared with password (request without password)
Given user "Alice" has been created with default attributes and without skeleton files
And user "Alice" has created folder "/PARENT"
And user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | read |
| password | %public% |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | view |
| password | %public% |
When the public sends "PROPFIND" request to the last public link share using the new public WebDAV API
Then the HTTP status code should be "401"
And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\NotAuthenticated"
@@ -73,10 +77,12 @@ Feature: PROPFIND
Scenario: send PROPFIND request to a public link shared with password (request with incorrect password)
Given user "Alice" has been created with default attributes and without skeleton files
And user "Alice" has created folder "/PARENT"
And user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | read |
| password | %public% |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | view |
| password | %public% |
When the public sends "PROPFIND" request to the last public link share using the new public WebDAV API with password "1234"
Then the HTTP status code should be "401"
And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\NotAuthenticated"