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

fix storage test

This commit is contained in:
Damodar Lohani 2022-02-15 08:49:04 +00:00
parent 625201a1c2
commit f3c358f24a

View file

@ -851,7 +851,7 @@ class RealtimeCustomClientTest extends Scope
$session = $user['session'] ?? '';
$projectId = $this->getProject()['$id'];
$client = $this->getWebsocket(['files', 'buckets'], [
$client = $this->getWebsocket(['files'], [
'origin' => 'http://localhost',
'cookie' => 'a_session_'.$projectId.'=' . $session
]);
@ -863,7 +863,6 @@ class RealtimeCustomClientTest extends Scope
$this->assertNotEmpty($response['data']);
$this->assertCount(2, $response['data']['channels']);
$this->assertContains('files', $response['data']['channels']);
$this->assertContains('buckets', $response['data']['channels']);
$this->assertNotEmpty($response['data']['user']);
$this->assertEquals($user['$id'], $response['data']['user']['$id']);
@ -881,18 +880,7 @@ class RealtimeCustomClientTest extends Scope
'write' => ['role:all'],
'permission' => 'bucket'
]);
$response = json_decode($client->receive(), true);
$this->assertArrayHasKey('type', $response);
$this->assertArrayHasKey('data', $response);
$this->assertEquals('event', $response['type']);
$this->assertNotEmpty($response['data']);
$this->assertArrayHasKey('timestamp', $response['data']);
$this->assertCount(2, $response['data']['channels']);
$this->assertContains('buckets', $response['data']['channels']);
$this->assertContains('buckets.' . $bucket1['body']['$id'], $response['data']['channels']);
$this->assertEquals('storage.buckets.create', $response['data']['event']);
$this->assertNotEmpty($response['data']['payload']);
$data = ['bucketId' => $bucket1['body']['$id']];
/**
* Test File Create
@ -944,7 +932,7 @@ class RealtimeCustomClientTest extends Scope
$this->assertArrayHasKey('timestamp', $response['data']);
$this->assertCount(3, $response['data']['channels']);
$this->assertContains('files', $response['data']['channels']);
$this->assertContains('files.' . $file['body']['$id'], $response['data']['channels']);
$this->assertContains('buckets.' . $data['bucketId'] . '.files.' . $file['body']['$id'], $response['data']['channels']);
$this->assertContains('buckets.' . $data['bucketId'] . '.files', $response['data']['channels']);
$this->assertEquals('storage.files.update', $response['data']['event']);
$this->assertNotEmpty($response['data']['payload']);
@ -966,7 +954,7 @@ class RealtimeCustomClientTest extends Scope
$this->assertArrayHasKey('timestamp', $response['data']);
$this->assertCount(3, $response['data']['channels']);
$this->assertContains('files', $response['data']['channels']);
$this->assertContains('files.' . $file['body']['$id'], $response['data']['channels']);
$this->assertContains('buckets.' . $data['bucketId'] . '.files.' . $file['body']['$id'], $response['data']['channels']);
$this->assertContains('buckets.' . $data['bucketId'] . '.files', $response['data']['channels']);
$this->assertEquals('storage.files.delete', $response['data']['event']);
$this->assertNotEmpty($response['data']['payload']);