From db08cd749ba6851480f868dedbb70c6dbf5e31e5 Mon Sep 17 00:00:00 2001 From: prashant-gurung899 Date: Mon, 25 Nov 2024 16:56:03 +0545 Subject: [PATCH] add tests to download thumbnail preview of a federated share image Signed-off-by: prashant-gurung899 --- tests/acceptance/bootstrap/WebDav.php | 36 ++++++++++++++++ .../acceptance/features/apiOcm/share.feature | 39 +++++++++++++----- .../fixtures/federated-share-thumbnail.png | Bin 0 -> 874 bytes 3 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 tests/acceptance/fixtures/federated-share-thumbnail.png diff --git a/tests/acceptance/bootstrap/WebDav.php b/tests/acceptance/bootstrap/WebDav.php index 7cdc683bde1..3cadaee71e1 100644 --- a/tests/acceptance/bootstrap/WebDav.php +++ b/tests/acceptance/bootstrap/WebDav.php @@ -3711,6 +3711,42 @@ public function userDownloadsThePreviewOfWithWidthHeightProcessorUsingWebDAVAPI( $this->setResponse($response); } + /** + * @When user :user downloads the preview of federated share image :path with width :width and height :height and processor :processor using the WebDAV API + * + * @param string $user + * @param string $path + * @param string $width + * @param string $height + * @param string $processor + * + * @return void + */ + public function userDownloadsThePreviewOfFederatedShareImageWithWidthHeightProcessorUsingWebDAVAPI(string $user, string $path, string $width, string $height, string $processor): void { + $user = $this->getActualUsername($user); + $urlParameter = [ + 'x' => $width, + 'y' => $height, + 'preview' => '1', + 'processor' => $processor + ]; + $spaceId = $this->spacesContext->getSharesRemoteItemId($user, $path); + $response = $this->makeDavRequest( + $user, + "GET", + $path, + [], + null, + $spaceId, + "files", + null, + false, + null, + $urlParameter, + ); + $this->setResponse($response); + } + /** * @Given user :user has downloaded the preview of shared resource :path with width :width and height :height * diff --git a/tests/acceptance/features/apiOcm/share.feature b/tests/acceptance/features/apiOcm/share.feature index c7c55117348..42f51f06844 100755 --- a/tests/acceptance/features/apiOcm/share.feature +++ b/tests/acceptance/features/apiOcm/share.feature @@ -707,11 +707,11 @@ Feature: an user shares resources using ScienceMesh application And using server "LOCAL" And user "Alice" has created a folder "FOLDER" in space "Personal" And user "Alice" has sent the following resource share invitation to federated user: - | resource | FOLDER | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Editor | + | resource | FOLDER | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor | When using server "REMOTE" And user "Brian" uploads a file with content "lorem" to "file.txt" inside federated share "FOLDER" via TUS using the WebDAV API Then for user "Brian" the content of file "file.txt" of federated share "FOLDER" should be "lorem" @@ -725,11 +725,30 @@ Feature: an user shares resources using ScienceMesh application And "Brian" has accepted invitation And user "Brian" has created a folder "FOLDER" in space "Personal" And user "Brian" has sent the following resource share invitation to federated user: - | resource | FOLDER | - | space | Personal | - | sharee | Alice | - | shareType | user | - | permissionsRole | Editor | + | resource | FOLDER | + | space | Personal | + | sharee | Alice | + | shareType | user | + | permissionsRole | Editor | When using server "LOCAL" And user "Alice" uploads a file with content "lorem" to "file.txt" inside federated share "FOLDER" via TUS using the WebDAV API Then for user "Alice" the content of file "file.txt" of federated share "FOLDER" should be "lorem" + + @issue-10495 + Scenario: local user downloads thumbnail preview of a federated shared image + Given using spaces DAV path + And using server "LOCAL" + And "Alice" has created the federation share invitation + And using server "REMOTE" + And "Brian" has accepted invitation + And user "Brian" has uploaded file "filesForUpload/testavatar.jpg" to "testavatar.jpg" + And user "Brian" has sent the following resource share invitation to federated user: + | resource | testavatar.jpg | + | space | Personal | + | sharee | Alice | + | shareType | user | + | permissionsRole | Viewer | + And using server "LOCAL" + When user "Alice" downloads the preview of federated share image "testavatar.jpg" with width "32" and height "32" and processor "thumbnail" using the WebDAV API + Then the HTTP status code should be "200" + And the downloaded preview content should match with "federated-share-thumbnail.png" fixtures preview content diff --git a/tests/acceptance/fixtures/federated-share-thumbnail.png b/tests/acceptance/fixtures/federated-share-thumbnail.png new file mode 100644 index 0000000000000000000000000000000000000000..7110deebe72065c0cece8986a811e1d237c15921 GIT binary patch literal 874 zcmex=KU|?coW@chxW@Tkz0jjJ8$}zAA zvI;30I#U-U>$dGXcJ4ZK_{h;?$4{I*b?NeztJkjIxOwa0qsLF4K70P+<*SdM zK7aZ8?fZ|PzZe;qA>IL!5Dy{wM-b>ACKeWE7Iu(-7@5j}m|2j8Rnd@5$T5&Tu~1ma zsF6d&Y2w0-2RW6EgFc8R6KQ!#m{`Vr(Mu#brIP!m}`f_n(=pZ~WQc$gW15ymXY zV9)UVSITC0ru?ag))h|nOXFJFd4O4MXZGDZUk9aVO^+jU<}KgG`Q?46#GRSmQ*Om3 z-CS2Qf41Z;`EA(_0&b2c*0FwN7ux7{gIR_#DopCZri{lKpG9UQpTB!vhTreU>Zx|e z3RmB`H#@jX>EYtytv3xAo;2{ko}kV0;#zNo?w*}%Z2Usj*}wc-OE{O_ zJa)9jQhicn=gG(O{Nvc|uIhX%`>uFoBir4cdF?%q**8ksbRFW$e06SC*X%HlXQ`KT zRrX92lYBD6D>T`YsVy{Ab;kU%x3B%9d9^}zTyZH^RA4p~lVHzyP;0k$b>)}cmYlkR vcRZ|{H{>+-Jdt@WBYb}^yVoXN>Dsw&2Np1RNW{&Q<+D!P`rP1&{r{T)&74M2 literal 0 HcmV?d00001