From e6996ad63a4a8bdee7caa9cd39d3c352d5e035b9 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 17 Oct 2021 13:59:03 +0545 Subject: [PATCH 1/3] fix webhook test --- tests/e2e/Services/Webhooks/WebhooksBase.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/Services/Webhooks/WebhooksBase.php b/tests/e2e/Services/Webhooks/WebhooksBase.php index b87e8aa435..b84fbc9251 100644 --- a/tests/e2e/Services/Webhooks/WebhooksBase.php +++ b/tests/e2e/Services/Webhooks/WebhooksBase.php @@ -246,6 +246,7 @@ trait WebhooksBase ]), [ 'bucketId' => 'unique()', 'name' => 'Test Bucket', + 'permission' => 'bucket', 'read' => ['role:all'], 'write' => ['role:all'] ]); From 1cf105d144c42ea7bd59e5fdfc1ecb550e2348a2 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 17 Oct 2021 14:02:03 +0545 Subject: [PATCH 2/3] no folderid field --- tests/e2e/Services/Storage/StorageCustomClientTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e/Services/Storage/StorageCustomClientTest.php b/tests/e2e/Services/Storage/StorageCustomClientTest.php index 7d5c49cbdd..c99587bb25 100644 --- a/tests/e2e/Services/Storage/StorageCustomClientTest.php +++ b/tests/e2e/Services/Storage/StorageCustomClientTest.php @@ -39,7 +39,6 @@ class StorageCustomClientTest extends Scope ], $this->getHeaders()), [ 'fileId' => 'unique()', 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'permissions.png'), - 'folderId' => 'xyz', ]); $this->assertEquals($file['headers']['status-code'], 201); From 37102f95f0ac3c467ccf70dd7ff3366c88bd261c Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 19 Oct 2021 12:40:06 +0545 Subject: [PATCH 3/3] update realtime tests for storage --- tests/e2e/Services/Realtime/RealtimeBase.php | 23 +++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/e2e/Services/Realtime/RealtimeBase.php b/tests/e2e/Services/Realtime/RealtimeBase.php index da5f3ce114..35e20d0a94 100644 --- a/tests/e2e/Services/Realtime/RealtimeBase.php +++ b/tests/e2e/Services/Realtime/RealtimeBase.php @@ -783,8 +783,25 @@ trait RealtimeBase /** * Test File Create + * TODO Buckets Channels */ - $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']); + + $bucketId = $bucket['body']['$id']; + + $file = $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()), [ @@ -813,7 +830,7 @@ trait RealtimeBase /** * Test File Update */ - $this->client->call(Client::METHOD_PUT, '/storage/files/' . $data['fileId'], array_merge([ + $this->client->call(Client::METHOD_PUT, '/storage/buckets/'.$bucketId.'files/' . $data['fileId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -837,7 +854,7 @@ trait RealtimeBase /** * Test File Delete */ - $this->client->call(Client::METHOD_DELETE, '/storage/files/' . $data['fileId'], array_merge([ + $this->client->call(Client::METHOD_DELETE, '/storage/buckets/'. $bucketId . 'files/' . $data['fileId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()));