Refactored step to use depth for propfind

This commit is contained in:
Prarup Gurung
2024-03-13 14:26:37 +05:45
parent bc2410900a
commit d48ea766ea
5 changed files with 27 additions and 28 deletions

View File

@@ -15,7 +15,7 @@ Feature: Propfind test
Scenario: space-admin checks the PROPFIND request of a space
Given user "Alice" has uploaded a file inside space "new-space" with content "some content" to "testfile.txt"
When user "Alice" sends PROPFIND request to space "new-space" using the WebDAV API
When user "Alice" sends PROPFIND request to space "new-space" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the following headers should match these regular expressions
| X-Request-Id | /^[a-zA-Z]+\/[a-zA-Z]+\.feature:\d+(-\d+)?$/ |
@@ -33,7 +33,7 @@ Feature: Propfind test
And user "Alice" has shared a space "new-space" with settings:
| shareWith | Brian |
| role | <role> |
When user "Brian" sends PROPFIND request to space "new-space" using the WebDAV API
When user "Brian" sends PROPFIND request to space "new-space" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the following headers should match these regular expressions
| X-Request-Id | /^[a-zA-Z]+\/[a-zA-Z]+\.feature:\d+(-\d+)?$/ |
@@ -56,7 +56,7 @@ Feature: Propfind test
And user "Alice" has shared a space "new-space" with settings:
| shareWith | Brian |
| role | <role> |
When user "Brian" sends PROPFIND request from the space "new-space" to the resource "folderMain" using the WebDAV API
When user "Brian" sends PROPFIND request from the space "new-space" to the resource "folderMain" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response should contain a space "new-space" with these key and value pairs:
| key | value |
@@ -77,7 +77,7 @@ Feature: Propfind test
And user "Alice" has shared a space "new-space" with settings:
| shareWith | Brian |
| role | <role> |
When user "Brian" sends PROPFIND request from the space "new-space" to the resource "folderMain/subFolder1/subFolder2" using the WebDAV API
When user "Brian" sends PROPFIND request from the space "new-space" to the resource "folderMain/subFolder1/subFolder2" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response should contain a space "new-space" with these key and value pairs:
| key | value |
@@ -98,7 +98,7 @@ Feature: Propfind test
And user "Alice" has shared a space "new-space" with settings:
| shareWith | Brian |
| role | <role> |
When user "Brian" sends PROPFIND request from the space "new-space" to the resource "testfile.txt" using the WebDAV API
When user "Brian" sends PROPFIND request from the space "new-space" to the resource "testfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response should contain a space "new-space" with these key and value pairs:
| key | value |

View File

@@ -15,7 +15,7 @@ Feature: lock files
When user "Alice" locks file "textfile.txt" using the WebDAV API setting the following properties
| lockscope | exclusive |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Alice" should contain a space "Alice Hansen" with these key and value pairs:
| key | value |
@@ -37,7 +37,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-5000 |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Alice" should contain a space "Alice Hansen" with these key and value pairs:
| key | value |
@@ -59,7 +59,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Alice" should contain a space "Alice Hansen" with these key and value pairs:
| key | value |
@@ -100,7 +100,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "200"
When user "Brian" sends PROPFIND request from the space "Project" to the resource "textfile.txt" using the WebDAV API
When user "Brian" sends PROPFIND request from the space "Project" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Brian" should contain a space "Project" with these key and value pairs:
| key | value |
@@ -127,7 +127,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "200"
When user "Brian" sends PROPFIND request from the space "Project" to the resource "textfile.txt" using the WebDAV API
When user "Brian" sends PROPFIND request from the space "Project" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Brian" should contain a space "Project" with these key and value pairs:
| key | value |
@@ -168,7 +168,7 @@ Feature: lock files
When user "Brian" locks file "/Shares/textfile.txt" using the WebDAV API setting the following properties
| lockscope | exclusive |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Alice" should contain a space "Alice Hansen" with these key and value pairs:
| key | value |
@@ -192,7 +192,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Alice" should contain a space "Alice Hansen" with these key and value pairs:
| key | value |
@@ -229,7 +229,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "423"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Alice" should contain a space "Alice Hansen" with these key and value pairs:
| key | value |
@@ -250,7 +250,7 @@ Feature: lock files
| lockscope | exclusive |
| timeout | Second-3600 |
Then the HTTP status code should be "423"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "textfile.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Alice" should contain a space "Alice Hansen" with these key and value pairs:
| key | value |

View File

@@ -26,7 +26,7 @@ Feature: Tag
| tag level#1 |
| tag with symbols @^$#^%$@%!_+) |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs:
| key | value |
@@ -34,7 +34,7 @@ Feature: Tag
When user "Alice" creates the following tags for file "folderMain/insideTheFolder.txt" of space "use-tag":
| fileTag |
Then the HTTP status code should be "200"
When user "Brian" sends PROPFIND request from the space "use-tag" to the resource "folderMain/insideTheFolder.txt" using the WebDAV API
When user "Brian" sends PROPFIND request from the space "use-tag" to the resource "folderMain/insideTheFolder.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs:
| key | value |
@@ -64,12 +64,12 @@ Feature: Tag
| fileTag |
| tag with symbol @^$#^%$@%!_+) |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "folderMain" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "folderMain" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Alice" should contain a mountpoint "Alice Hansen" with these key and value pairs:
| key | value |
| oc:tags | my tag,important |
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "file.txt" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "file.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response to user "Alice" should contain a mountpoint "Alice Hansen" with these key and value pairs:
| key | value |
@@ -177,7 +177,7 @@ Feature: Tag
When user "Alice" removes the following tags for folder "folderMain" of space "use-tag":
| folderTag |
| marketing |
And user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" using the WebDAV API
And user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs:
| key | value |
@@ -255,7 +255,7 @@ Feature: Tag
When user "Alice" creates the following tags for folder "folderMain" of space "use-tag":
| finance, |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs:
| key | value |
@@ -263,7 +263,7 @@ Feature: Tag
When user "Alice" creates the following tags for file "folderMain/insideTheFolder.txt" of space "use-tag":
| file,,Tag |
Then the HTTP status code should be "200"
When user "Brian" sends PROPFIND request from the space "use-tag" to the resource "folderMain/insideTheFolder.txt" using the WebDAV API
When user "Brian" sends PROPFIND request from the space "use-tag" to the resource "folderMain/insideTheFolder.txt" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs:
| key | value |
@@ -283,7 +283,7 @@ Feature: Tag
When user "Alice" creates the following tags for folder "folderMain" of space "use-tag":
| engineering,finance,qa |
Then the HTTP status code should be "200"
When user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" using the WebDAV API
When user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs:
| key | value |

View File

@@ -3596,8 +3596,7 @@ class SpacesContext implements Context {
}
/**
* @When /^user "([^"]*)" sends PROPFIND request to space "([^"]*)" using the WebDAV API$/
* @When /^user "([^"]*)" sends PROPFIND request from the space "([^"]*)" to the resource "([^"]*)" using the WebDAV API$/
* @When /^user "([^"]*)" sends PROPFIND request to space "([^"]*)" with depth "([^"]*)" using the WebDAV API$/
* @When /^user "([^"]*)" sends PROPFIND request from the space "([^"]*)" to the resource "([^"]*)" with depth "([^"]*)" using the WebDAV API$/
*
* @param string $user
@@ -3611,7 +3610,7 @@ class SpacesContext implements Context {
*
* @throws GuzzleException
*/
public function userSendsPropfindRequestToSpace(string $user, string $spaceName, ?string $resource = "", ?string $folderDepth = "0"): void {
public function userSendsPropfindRequestToSpace(string $user, string $spaceName, ?string $resource = "", ?string $folderDepth = "1"): void {
$this->featureContext->setResponse(
$this->sendPropfindRequestToSpace($user, $spaceName, $resource, null, $folderDepth)
);
@@ -3639,7 +3638,7 @@ class SpacesContext implements Context {
$headers[$row['header']] = $row ['value'];
}
$this->featureContext->setResponse(
$this->sendPropfindRequestToSpace($user, $spaceName, '', $headers)
$this->sendPropfindRequestToSpace($user, $spaceName, '', $headers, '0')
);
}
@@ -3655,7 +3654,7 @@ class SpacesContext implements Context {
*
* @throws JsonException
*/
public function sendPropfindRequestToSpace(string $user, string $spaceName, ?string $resource = "", ?array $headers = [], ?string $folderDepth = "0"): ResponseInterface {
public function sendPropfindRequestToSpace(string $user, string $spaceName, ?string $resource = "", ?array $headers = [], ?string $folderDepth = "1"): ResponseInterface {
$this->setSpaceIDByName($user, $spaceName);
$properties = [
'oc:id',

View File

@@ -914,7 +914,7 @@ class WebDavLockingContext implements Context {
* @throws GuzzleException
*/
public function numberOfLockShouldBeReportedInProjectSpace(int $count, string $file, string $spaceName, string $user) {
$response = $this->spacesContext->sendPropfindRequestToSpace($user, $spaceName, $file);
$response = $this->spacesContext->sendPropfindRequestToSpace($user, $spaceName, $file, null, '0');
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
$responseXml = $this->featureContext->getResponseXml($response);
$xmlPart = $responseXml->xpath("//d:response//d:lockdiscovery/d:activelock");