fix storage tests
This commit is contained in:
parent
89d9feaa99
commit
cecc863717
|
@ -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) {
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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()), [
|
||||
|
|
|
@ -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']);
|
||||
|
|
Loading…
Reference in a new issue