From 02f54eca6525fb59955744b07d9ecdd42f7beb19 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 6 Sep 2022 13:02:32 +1200 Subject: [PATCH] Fix tests --- composer.json | 2 +- composer.lock | 14 +++++++------- .../Databases/DatabasesCustomClientTest.php | 8 ++++++-- .../Databases/DatabasesPermissionsGuestTest.php | 2 +- .../Functions/FunctionsCustomServerTest.php | 1 + .../Services/Storage/StorageCustomClientTest.php | 13 ++++++++----- tests/e2e/Services/Webhooks/WebhooksBase.php | 1 - .../Services/Webhooks/WebhooksCustomClientTest.php | 2 ++ 8 files changed, 26 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 52f26d24de..a792a11a4c 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "utopia-php/cache": "0.6.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "dev-feat-write-helper as 0.24.0", + "utopia-php/database": "0.24.0", "utopia-php/locale": "0.4.*", "utopia-php/registry": "0.5.*", "utopia-php/preloader": "0.2.*", diff --git a/composer.lock b/composer.lock index ac4e07cb0e..04659290c3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "acf850ed1f73f172c7573daf5ca54940", + "content-hash": "ee4de251e5e0a3bf5f982bded0d28176", "packages": [ { "name": "adhocore/jwt", @@ -2840,16 +2840,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.23.0", + "version": "0.24.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "efadccb9abd6263d045ef157881143d3a59dc710" + "reference": "310ab7210ee97266632ee2df9616c9770c7b37e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/efadccb9abd6263d045ef157881143d3a59dc710", - "reference": "efadccb9abd6263d045ef157881143d3a59dc710", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/310ab7210ee97266632ee2df9616c9770c7b37e6", + "reference": "310ab7210ee97266632ee2df9616c9770c7b37e6", "shasum": "" }, "require": { @@ -2884,9 +2884,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.23.0" + "source": "https://github.com/appwrite/sdk-generator/tree/0.24.0" }, - "time": "2022-09-04T17:29:33+00:00" + "time": "2022-09-05T06:37:25+00:00" }, { "name": "doctrine/instantiator", diff --git a/tests/e2e/Services/Databases/DatabasesCustomClientTest.php b/tests/e2e/Services/Databases/DatabasesCustomClientTest.php index 9f86bb66c0..da4eb80da5 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomClientTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomClientTest.php @@ -43,7 +43,9 @@ class DatabasesCustomClientTest extends Scope 'name' => 'Movies', 'documentSecurity' => true, 'permissions' => [ - Permission::write(Role::user($this->getUser()['$id'])), + // To avoid need for a Database release for now + //Permission::write(Role::user($this->getUser()['$id'])), + 'write("user:' . $this->getUser()['$id'] . '")', ], ]); @@ -75,7 +77,9 @@ class DatabasesCustomClientTest extends Scope 'title' => 'Captain America', ], 'permissions' => [ - Permission::write(Role::user($this->getUser()['$id'])), + // To avoid need for a Database release for now + //Permission::write(Role::user($this->getUser()['$id'])), + 'write("user:' . $this->getUser()['$id'] . '")', ] ]); diff --git a/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php b/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php index c2293e30f4..1c15a363a8 100644 --- a/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php +++ b/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php @@ -237,7 +237,7 @@ class DatabasesPermissionsGuestTest extends Scope 'name' => 'GuestPermissionsWrite', ]); $this->assertEquals(201, $database['headers']['status-code']); - $this->assertEquals('InvalidDocumentDatabase', $database['body']['name']); + $this->assertEquals('GuestPermissionsWrite', $database['body']['name']); $databaseId = $database['body']['$id']; $movies = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', $this->getServerHeader(), [ diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 208382ae43..5e49599230 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -727,6 +727,7 @@ class FunctionsCustomServerTest extends Scope /** * @depends testUpdateDeployment */ + #[Retry(count: 1)] public function testSyncCreateExecution($data): array { /** diff --git a/tests/e2e/Services/Storage/StorageCustomClientTest.php b/tests/e2e/Services/Storage/StorageCustomClientTest.php index 0e4daa9957..fb2d93b371 100644 --- a/tests/e2e/Services/Storage/StorageCustomClientTest.php +++ b/tests/e2e/Services/Storage/StorageCustomClientTest.php @@ -1080,7 +1080,9 @@ class StorageCustomClientTest extends Scope 'bucketId' => ID::unique(), 'name' => 'Test Bucket', 'permissions' => [ - Permission::write(Role::user($this->getUser()['$id'])), + // To avoid need for a Database release for now + //Permission::write(Role::user($this->getUser()['$id'])), + 'write("user:' . $this->getUser()['$id'] . '")', ], 'fileSecurity' => true, ]); @@ -1100,7 +1102,9 @@ class StorageCustomClientTest extends Scope 'fileId' => ID::unique(), 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'permissions.png'), 'permissions' => [ - Permission::write(Role::user($this->getUser()['$id'])), + // To avoid need for a Database release for now + //Permission::write(Role::user($this->getUser()['$id'])), + 'write("user:' . $this->getUser()['$id'] . '")', ] ]); @@ -1282,9 +1286,8 @@ class StorageCustomClientTest extends Scope ], $this->getHeaders()), [ 'permissions' => [ Permission::read(Role::user(ID::custom('notme'))), - Permission::create(Role::user(ID::custom('notme'))), - Permission::update(Role::user(ID::custom('notme'))), - Permission::delete(Role::user(ID::custom('notme'))), + Permission::update(Role::user(ID::custom('notme'))), + Permission::delete(Role::user(ID::custom('notme'))), ], ]); diff --git a/tests/e2e/Services/Webhooks/WebhooksBase.php b/tests/e2e/Services/Webhooks/WebhooksBase.php index b12faf6321..bb7edfdb46 100644 --- a/tests/e2e/Services/Webhooks/WebhooksBase.php +++ b/tests/e2e/Services/Webhooks/WebhooksBase.php @@ -556,7 +556,6 @@ trait WebhooksBase ], $this->getHeaders()), [ 'permissions' => [ Permission::read(Role::any()), - Permission::create(Role::any()), Permission::update(Role::any()), Permission::delete(Role::any()), ], diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php index 7c30234727..9e26322931 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php @@ -2,6 +2,7 @@ namespace Tests\E2E\Services\Webhooks; +use Appwrite\Tests\Retry; use Tests\E2E\Client; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; @@ -416,6 +417,7 @@ class WebhooksCustomClientTest extends Scope /** * @depends testDeleteAccountSessions */ + #[Retry(count: 1)] public function testUpdateAccountName($data): array { $id = $data['id'] ?? '';