mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Call server create bucket for client storage tests
This commit is contained in:
@@ -6,7 +6,6 @@ use Tests\E2E\Client;
|
||||
use Tests\E2E\Scopes\ProjectCustom;
|
||||
use Tests\E2E\Scopes\Scope;
|
||||
use Tests\E2E\Scopes\SideClient;
|
||||
use Tests\E2E\Scopes\SideServer;
|
||||
|
||||
class GraphQLStorageClientTest extends Scope
|
||||
{
|
||||
@@ -14,6 +13,38 @@ class GraphQLStorageClientTest extends Scope
|
||||
use SideClient;
|
||||
use GraphQLBase;
|
||||
|
||||
public function testCreateBucket(): array
|
||||
{
|
||||
$projectId = $this->getProject()['$id'];
|
||||
$query = $this->getQuery(self::$CREATE_BUCKET);
|
||||
$gqlPayload = [
|
||||
'query' => $query,
|
||||
'variables' => [
|
||||
'bucketId' => 'actors',
|
||||
'name' => 'Actors',
|
||||
'permission' => 'bucket',
|
||||
'read' => ['role:all'],
|
||||
'write' => ['role:all'],
|
||||
]
|
||||
];
|
||||
|
||||
$bucket = $this->client->call(Client::METHOD_POST, '/graphql', [
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $projectId,
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], $gqlPayload);
|
||||
|
||||
$this->assertIsArray($bucket['body']['data']);
|
||||
$this->assertArrayNotHasKey('errors', $bucket['body']);
|
||||
$bucket = $bucket['body']['data']['storageCreateBucket'];
|
||||
$this->assertEquals('Actors', $bucket['name']);
|
||||
|
||||
return $bucket;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateBucket
|
||||
*/
|
||||
public function testCreateFile($bucket): array
|
||||
{
|
||||
$projectId = $this->getProject()['$id'];
|
||||
@@ -257,4 +288,4 @@ class GraphQLStorageClientTest extends Scope
|
||||
|
||||
$this->assertEquals(204, $file['headers']['status-code']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user