diff options
author | Louis Chemineau <louis@chmn.me> | 2022-01-11 10:56:49 +0100 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2022-01-11 17:10:14 +0100 |
commit | 69b8044b8f957c5a74396025608dd513c8f7ff7d (patch) | |
tree | a39db9e1f9753f59b6d7b7e3256ec655d8a93ee2 /build/integration | |
parent | b23934a45ec584e398835635584461a02c9b1dde (diff) | |
download | nextcloud-server-69b8044b8f957c5a74396025608dd513c8f7ff7d.tar.gz nextcloud-server-69b8044b8f957c5a74396025608dd513c8f7ff7d.zip |
Set the file's mtime from the headers in bulk upload
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'build/integration')
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 42 | ||||
-rw-r--r-- | build/integration/features/webdav-related.feature | 3 |
2 files changed, 44 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 2db51d8b22f..09e2680e5ed 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -208,6 +208,19 @@ trait WebDav { } /** + * @Then /^File "([^"]*)" should have prop "([^"]*):([^"]*)" equal to "([^"]*)"$/ + * @param string $file + * @param string $prefix + * @param string $prop + * @param string $value + */ + public function checkPropForFile($file, $prefix, $prop, $value) { + $elementList = $this->propfindFile($this->currentUser, $file, "<$prefix:$prop/>"); + $property = $elementList['/'.$this->getDavFilesPath($this->currentUser).$file][200]["{DAV:}$prop"]; + Assert::assertEquals($property, $value); + } + + /** * @Then /^Downloaded content when downloading file "([^"]*)" with range "([^"]*)" should be "([^"]*)"$/ * @param string $fileSource * @param string $range @@ -386,6 +399,30 @@ trait WebDav { * @param string $properties properties which needs to be included in the report * @param string $filterRules filter-rules to choose what needs to appear in the report */ + public function propfindFile($user, $path, $properties = '') { + $client = $this->getSabreClient($user); + + $body = '<?xml version="1.0" encoding="utf-8" ?> + <d:propfind xmlns:d="DAV:" + xmlns:oc="http://owncloud.org/ns" + xmlns:nc="http://nextcloud.org/ns" + xmlns:ocs="http://open-collaboration-services.org/ns"> + <d:prop> + ' . $properties . ' + </d:prop> + </d:propfind>'; + + $response = $client->request('PROPFIND', $this->makeSabrePath($user, $path), $body); + $parsedResponse = $client->parseMultistatus($response['body']); + return $parsedResponse; + } + + /* Returns the elements of a report command + * @param string $user + * @param string $path + * @param string $properties properties which needs to be included in the report + * @param string $filterRules filter-rules to choose what needs to appear in the report + */ public function reportFolder($user, $path, $properties, $filterRules) { $client = $this->getSabreClient($user); @@ -561,25 +598,28 @@ trait WebDav { * @param string $name3 * @param string $content3 */ - public function userUploadsChunkedFiles($user, $name1, $content1, $name2, $content2, $name3, $content3) { + public function userUploadsBulkedFiles($user, $name1, $content1, $name2, $content2, $name3, $content3) { $boundary = "boundary_azertyuiop"; $body = ""; $body .= '--'.$boundary."\r\n"; $body .= "X-File-Path: ".$name1."\r\n"; $body .= "X-File-MD5: f6a6263167c92de8644ac998b3c4e4d1\r\n"; + $body .= "X-OC-Mtime: 1111111111\r\n"; $body .= "Content-Length: ".strlen($content1)."\r\n"; $body .= "\r\n"; $body .= $content1."\r\n"; $body .= '--'.$boundary."\r\n"; $body .= "X-File-Path: ".$name2."\r\n"; $body .= "X-File-MD5: 87c7d4068be07d390a1fffd21bf1e944\r\n"; + $body .= "X-OC-Mtime: 2222222222\r\n"; $body .= "Content-Length: ".strlen($content2)."\r\n"; $body .= "\r\n"; $body .= $content2."\r\n"; $body .= '--'.$boundary."\r\n"; $body .= "X-File-Path: ".$name3."\r\n"; $body .= "X-File-MD5: e86a1cf0678099986a901c79086f5617\r\n"; + $body .= "X-File-Mtime: 3333333333\r\n"; $body .= "Content-Length: ".strlen($content3)."\r\n"; $body .= "\r\n"; $body .= $content3."\r\n"; diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index 78ec6a93c50..4470e317cdf 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -615,10 +615,13 @@ Feature: webdav-related When As an "user0" Then Downloading file "/A.txt" And Downloaded content should be "AAAAA" + And File "/A.txt" should have prop "d:getlastmodified" equal to "Fri, 18 Mar 2005 01:58:31 GMT" And Downloading file "/B.txt" And Downloaded content should be "BBBBB" + And File "/B.txt" should have prop "d:getlastmodified" equal to "Sat, 02 Jun 2040 03:57:02 GMT" And Downloading file "/C.txt" And Downloaded content should be "CCCCC" + And File "/C.txt" should have prop "d:getlastmodified" equal to "Sun, 18 Aug 2075 05:55:33 GMT" Scenario: Creating a folder with invalid characters Given using new dav path |