update tests for preview
This commit is contained in:
parent
94a18ede78
commit
83a009dcba
|
@ -27,7 +27,7 @@ trait StorageBase
|
|||
'name' => 'Test Bucket',
|
||||
'fileSecurity' => true,
|
||||
'maximumFileSize' => 2000000, //2MB
|
||||
'allowedFileExtensions' => ["jpg", "png"],
|
||||
'allowedFileExtensions' => ["jpg", "png", 'jfif'],
|
||||
'permissions' => [
|
||||
Permission::read(Role::any()),
|
||||
Permission::create(Role::any()),
|
||||
|
@ -462,6 +462,32 @@ trait StorageBase
|
|||
$this->assertEquals('image/png', $file2['headers']['content-type']);
|
||||
$this->assertNotEmpty($file2['body']);
|
||||
|
||||
// upload JXL file for preview
|
||||
$fileJfif = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([
|
||||
'content-type' => 'multipart/form-data',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'fileId' => ID::unique(),
|
||||
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/disk-a/preview-test.jfif'), 'image/jxl', 'preview-test.jfif'),
|
||||
'permissions' => [
|
||||
Permission::read(Role::any()),
|
||||
Permission::update(Role::any()),
|
||||
Permission::delete(Role::any()),
|
||||
],
|
||||
]);
|
||||
$this->assertEquals(201, $fileJfif['headers']['status-code']);
|
||||
$this->assertNotEmpty($fileJfif['body']['$id']);
|
||||
|
||||
// TEST preview JXL
|
||||
$preview = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileJfif['body']['$id'] . '/preview', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(200, $preview['headers']['status-code']);
|
||||
$this->assertEquals('image/jpeg', $preview['headers']['content-type']);
|
||||
$this->assertNotEmpty($preview['body']);
|
||||
|
||||
//new image preview features
|
||||
$file3 = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $data['fileId'] . '/preview', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
|
|
BIN
tests/resources/disk-a/preview-test.jfif
Normal file
BIN
tests/resources/disk-a/preview-test.jfif
Normal file
Binary file not shown.
After Width: | Height: | Size: 129 KiB |
Loading…
Reference in a new issue