Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/gallery.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-08-20 01:22:33 +0300
committerOlivier Paroz <github@oparoz.com>2015-08-20 01:22:33 +0300
commitfb5d902e115c5a4b313a1fc468b5a3dbacf7c739 (patch)
tree73aca712f0ad1aca903359fe335077fbbddf62cd /tests/unit
parent79b85c933c8eb2dadda746508ce39d3cc5580a36 (diff)
Test for preview of broken file
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/controller/PreviewControllerTest.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/unit/controller/PreviewControllerTest.php b/tests/unit/controller/PreviewControllerTest.php
index bc5987a7..b6fca34d 100644
--- a/tests/unit/controller/PreviewControllerTest.php
+++ b/tests/unit/controller/PreviewControllerTest.php
@@ -121,8 +121,7 @@ class PreviewControllerTest extends \Test\TestCase {
// TODO Save to a temp file and check the dimensions
//$this->assertEquals($preview['preview'], $response->render());
}
-
-
+
public function testGetPreviewWithWrongId() {
$fileId = 99999;
$width = 1024;
@@ -130,14 +129,17 @@ class PreviewControllerTest extends \Test\TestCase {
$this->mockGetResourceFromId($fileId, false);
- // Todo: Only match status and success
$errorResponse = new JSONResponse(
- ['message' => 'Oh Nooooes!', 'success' => false], Http::STATUS_NOT_FOUND
+ [
+ 'message' => "I'm truly sorry, but we were unable to generate a preview for this file",
+ 'success' => false
+ ], Http::STATUS_INTERNAL_SERVER_ERROR
);
$response = $this->controller->getPreview($fileId, $width, $height);
- $this->assertEquals($errorResponse->getData(), $response->getData());
+ $this->assertEquals($errorResponse->getStatus(), $response->getStatus());
+ $this->assertEquals($errorResponse->getData()['success'], $response->getData()['success']);
}
/**
@@ -230,7 +232,7 @@ class PreviewControllerTest extends \Test\TestCase {
*/
private function mockPreviewData($file) {
$preview = [
- 'preview' => $file->getContent(), // Not a real preview, but it's not important
+ 'preview' => $file->getContent(), // Not a real preview, but it's not important
'mimetype' => 'image/png', //Most previews are PNGs
];