1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

fix storage tests

This commit is contained in:
Damodar Lohani 2021-10-17 12:57:59 +05:45
parent 89d9feaa99
commit cecc863717
4 changed files with 20 additions and 5 deletions

View file

@ -255,7 +255,7 @@ App::post('/v1/storage/buckets')
'$collection' => 'buckets',
'dateCreated' => \time(),
'dateUpdated' => \time(),
'name' => $name,
'name' => $name,
'permission' => $permission,
'maximumFileSize' => $maximumFileSize,
'allowedFileExtensions' => $allowedFileExtensions,
@ -263,8 +263,8 @@ App::post('/v1/storage/buckets')
'adapter' => $adapter,
'encryption' => $encryption,
'antiVirus' => $antiVirus,
'$read' => $read,
'$write' => $write,
'$read' => $read ?? [],
'$write' => $write ?? [],
'search' => implode(' ', [$bucketId, $name]),
]));
} catch (Duplicate $th) {

View file

@ -53,6 +53,7 @@ class StorageConsoleClientTest extends Scope
], $this->getHeaders()), [
'bucketId' => 'unique()',
'name' => 'Test Bucket',
'permission' => 'file'
]);
$this->assertEquals(201, $bucket['headers']['status-code']);
$bucketId = $bucket['body']['$id'];

View file

@ -19,7 +19,21 @@ class StorageCustomClientTest extends Scope
/**
* Test for SUCCESS
*/
$file = $this->client->call(Client::METHOD_POST, '/storage/files', array_merge([
$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'],
], $this->getHeaders()), [
'bucketId' => 'unique()',
'name' => 'Test Bucket',
'permission' => 'file',
'read' => ['role:all'],
'write' => ['role:all'],
]);
$this->assertEquals(201, $bucket['headers']['status-code']);
$this->assertNotEmpty($bucket['body']['$id']);
$file = $this->client->call(Client::METHOD_POST, '/storage/buckets/'. $bucket['body']['$id'] . '/files', array_merge([
'content-type' => 'multipart/form-data',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [

View file

@ -92,7 +92,7 @@ class StorageCustomServerTest extends Scope
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'after' => $response['body']['buckets'][0]['$id']
'cursor' => $response['body']['buckets'][0]['$id']
]);
$this->assertEquals(200, $response['headers']['status-code']);