1
0
Fork 0
mirror of synced 2024-06-14 00:34:51 +12:00

update tests for preview

This commit is contained in:
Damodar Lohani 2023-12-28 02:22:05 +00:00
parent 94a18ede78
commit 83a009dcba
2 changed files with 27 additions and 1 deletions

View file

@ -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',

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB