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
path: root/tests/api
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/api
parent79b85c933c8eb2dadda746508ce39d3cc5580a36 (diff)
Test for preview of broken file
Diffstat (limited to 'tests/api')
-rw-r--r--tests/api/GetConfigCest.php16
-rw-r--r--tests/api/GetPreviewCest.php16
2 files changed, 19 insertions, 13 deletions
diff --git a/tests/api/GetConfigCest.php b/tests/api/GetConfigCest.php
index 494369cd..c57872fa 100644
--- a/tests/api/GetConfigCest.php
+++ b/tests/api/GetConfigCest.php
@@ -94,18 +94,10 @@ class GetConfigCest {
/**
* TODO Replace with JSONPath once the library is fixed
*/
- $I->seeResponseContainsJson(
- [
- "mediatypes" => [
- "image/png" => "/core/img/filetypes/image.png",
- "image/jpeg" => "/core/img/filetypes/image.png",
- "image/gif" => "/core/img/filetypes/image.png",
- "application/postscript" => "/core/img/filetypes/image-vector.png",
- "application/font-sfnt" => "/core/img/filetypes/font.png",
- "application/x-font" => "/core/img/filetypes/font.png"
- ]
- ]
- );
+ $mediaTypes = $this->mediaTypes;
+ $mediaTypes['mediatypes'] = ["application/font-sfnt" => "/core/img/filetypes/font.png"];
+ $mediaTypes['mediatypes'] = ["application/x-font" => "/core/img/filetypes/font.png"];
+ $I->seeResponseContainsJson($mediaTypes);
}
/**
diff --git a/tests/api/GetPreviewCest.php b/tests/api/GetPreviewCest.php
index e8b125a5..cd0d889f 100644
--- a/tests/api/GetPreviewCest.php
+++ b/tests/api/GetPreviewCest.php
@@ -37,7 +37,7 @@ class GetPreviewCest {
* @param \Step\Api\Anonymous $I
*/
public function unauthorizedAccess(\Step\Api\Anonymous $I) {
- $I->connectToTheApi($this->apiUrl. '/9999999/1920/1080', 'the preview API');
+ $I->connectToTheApi($this->apiUrl . '/9999999/1920/1080', 'the preview API');
}
public function getPreview(\Step\Api\User $I) {
@@ -62,4 +62,18 @@ class GetPreviewCest {
$I->sendGET($url);
$I->seeResponseCodeIs(404);
}
+
+ public function getPreviewOfBrokenFile(\Step\Api\User $I) {
+ $I->am('an app');
+ $I->wantTo('get the preview of a broken file');
+ $I->expect('an 500 status and an error message');
+
+ $I->getUserCredentialsAndUseHttpAuthentication();
+ $data = $I->getFilesDataForFolder('');
+ $file = $data['testimage-corrupt.jpg'];
+ $url = $this->apiUrl . '/' . $file['id'] . '/1920/1080';
+ $I->sendGET($url);
+ $I->seeResponseCodeIs(500);
+ $I->seeResponseContainsJson(['success' => false]);
+ }
}