test for bucket file size limit
This commit is contained in:
parent
0f317ffa24
commit
80b9fbd3ef
|
@ -4,7 +4,6 @@ namespace Tests\E2E\Services\Storage;
|
|||
|
||||
use CURLFile;
|
||||
use Tests\E2E\Client;
|
||||
use Utopia\Image\Image;
|
||||
|
||||
trait StorageBase
|
||||
{
|
||||
|
@ -16,9 +15,10 @@ trait StorageBase
|
|||
$bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], $this->getHeaders()), [
|
||||
'name' => 'Test Bucket',
|
||||
'maximumFileSize' => 2000000, //2MB
|
||||
'read' => ['role:all'],
|
||||
'write' => ['role:all'],
|
||||
]);
|
||||
|
@ -56,6 +56,27 @@ trait StorageBase
|
|||
]);
|
||||
$this->assertEquals(404, $res['headers']['status-code']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE large file size
|
||||
*/
|
||||
|
||||
$res = $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()), [
|
||||
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/disk-b/kitten-1.png'), 'image/png', 'kitten-1.png'),
|
||||
'read' => ['role:all'],
|
||||
'write' => ['role:all'],
|
||||
]);
|
||||
|
||||
$this->assertEquals(400, $res['headers']['status-code']);
|
||||
$this->assertEquals('File size not allowed', $res['body']['message']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE unsupported bucket extension
|
||||
* TODO awaiting FileType validator update
|
||||
*/
|
||||
|
||||
return ['bucketId' => $bucketId, 'fileId' => $file['body']['$id']];
|
||||
}
|
||||
|
||||
|
@ -141,7 +162,6 @@ trait StorageBase
|
|||
'rotation' => '45',
|
||||
]);
|
||||
|
||||
|
||||
$this->assertEquals(200, $file3['headers']['status-code']);
|
||||
$this->assertEquals('image/png', $file3['headers']['content-type']);
|
||||
$this->assertNotEmpty($file3['body']);
|
||||
|
@ -369,7 +389,6 @@ trait StorageBase
|
|||
'rotation' => '45',
|
||||
]);
|
||||
|
||||
|
||||
$this->assertEquals(200, $file3['headers']['status-code']);
|
||||
$this->assertEquals('image/png', $file3['headers']['content-type']);
|
||||
$this->assertNotEmpty($file3['body']);
|
||||
|
|
Loading…
Reference in a new issue