From aae418c2ab6e674dcd4959decb530f4f7bfa50f7 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Thu, 5 Jan 2023 17:54:33 +0545 Subject: [PATCH] add test to PROPFIND folder --- .../delayPostprocessing.feature | 19 +++++++++++++++-- .../bootstrap/WebDavPropertiesContext.php | 21 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature b/tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature index 21584686ab..8176ea70e0 100644 --- a/tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature +++ b/tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature @@ -3,10 +3,10 @@ Feature: delay post-processing of uploaded files Background: Given user "Alice" has been created with default attributes and without skeleton files - And user "Alice" has uploaded file with content "uploaded content" to "/file.txt" @issue-5326 Scenario Outline: user sends GET request to the file while it's still being processed + Given user "Alice" has uploaded file with content "uploaded content" to "/file.txt" When user "Alice" requests "" with "GET" without retrying Then the HTTP status code should be "425" Examples: @@ -17,6 +17,7 @@ Feature: delay post-processing of uploaded files Scenario Outline: user sends PROPFIND request to the file while it's still being processed + Given user "Alice" has uploaded file with content "uploaded content" to "/file.txt" When user "Alice" requests "" with "PROPFIND" without retrying Then the HTTP status code should be "207" And the value of the item "//d:response/d:propstat/d:status" in the response should be "HTTP/1.1 425 TOO EARLY" @@ -24,4 +25,18 @@ Feature: delay post-processing of uploaded files | dav_path | | /remote.php/webdav/file.txt | | /remote.php/dav/files/%username%/file.txt | - | /dav/spaces/%spaceid%/file.txt | \ No newline at end of file + | /dav/spaces/%spaceid%/file.txt | + + + Scenario Outline: user sends PROPFIND request to the folder while its some files are still being processed + Given user "Alice" has created folder "my_data" + And user "Alice" has uploaded file with content "uploaded content" to "/my_data/file.txt" + When user "Alice" requests "" with "PROPFIND" without retrying + Then the HTTP status code should be "207" + And as user "Alice" the value of the item "//d:status" of path "/" in the response should be "HTTP/1.1 200 OK" + And as user "Alice" the value of the item "//d:status" of path "/file.txt" in the response should be "HTTP/1.1 425 TOO EARLY" + Examples: + | dav_path | + | /remote.php/webdav/my_data | + | /remote.php/dav/files/%username%/my_data | + | /dav/spaces/%spaceid%/my_data | \ No newline at end of file diff --git a/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php b/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php index 62275ef27b..6aa673e1b0 100644 --- a/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php +++ b/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php @@ -644,6 +644,27 @@ class WebDavPropertiesContext implements Context { ); } + /** + * @Then as user :user the value of the item :xpath of path :path in the response should be :value + * + * @param string $user + * @param string $xpath + * @param string $path + * @param string $expectedValue + * + * @return void + * @throws Exception + */ + public function valueOfItemOfPathShouldBe(string $user, string $xpath, string $path, string $expectedValue):void { + $path = $this->featureContext->substituteInLineCodes($path, $user); + $fullXpath = "//d:response/d:href[.='$path']/following-sibling::d:propstat$xpath"; + $this->assertValueOfItemInResponseAboutUserIs( + $fullXpath, + null, + $expectedValue + ); + } + /** * @Then the value of the item :xpath in the response about user :user should be :value *