add test to download preview with preview set to zero

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899
2024-09-18 14:23:43 +05:45
parent d4ec147a57
commit 417294e520
2 changed files with 61 additions and 0 deletions

View File

@@ -3691,6 +3691,38 @@ trait WebDav {
$this->setResponse($response);
}
/**
* @When user :user tries to download the preview of :path with width :width and height :height and preview set to 0 using the WebDAV API
*
* @param string $user
* @param string $path
* @param string $width
* @param string $height
*
* @return void
*/
public function userDownloadsThePreviewOfWithPreviewZero(string $user, string $path, string $width, string $height) {
$user = $this->getActualUsername($user);
$urlParameter = [
'x' => $width,
'y' => $height,
'preview' => '0'
];
$response = $this->makeDavRequest(
$user,
"GET",
$path,
[],
null,
"files",
null,
false,
null,
$urlParameter,
);
$this->setResponse($response);
}
/**
* @When user :user downloads the preview of shared resource :path with width :width and height :height using the WebDAV API
*

View File

@@ -315,3 +315,32 @@ Feature: previews of files downloaded through the webdav API
| old |
| new |
| spaces |
Scenario Outline: try to download preview of an image with preview set to 0
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "/testavatar.jpg"
When user "Alice" tries to download the preview of "/testavatar.jpg" with width "32" and height "32" and preview set to 0 using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded image should be "1240" pixels wide and "648" pixels high
Examples:
| dav-path-version |
| old |
| new |
| spaces |
Scenario Outline: try to download preview of a text file with preview set to 0
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file with content "to preview" to "textfile.txt"
When user "Alice" tries to download the preview of "textfile.txt" with width "32" and height "32" and preview set to 0 using the WebDAV API
Then the HTTP status code should be "200"
And the content in the response should match the following content:
"""
to preview
"""
Examples:
| dav-path-version |
| old |
| new |
| spaces |