From ff14e5dcec49a021cce23334945d79b6604b26a1 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 6 Jul 2026 20:57:55 +0400 Subject: [PATCH] Add bucket teardown to folder tests and dot segment validator case --- tests/e2e/Services/Storage/StorageBase.php | 21 +++++++++++++++++++ .../Storage/StorageCustomClientTest.php | 7 +++++++ .../Utopia/Database/Validator/FolderTest.php | 1 + 3 files changed, 29 insertions(+) diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index 163059be40..295303abb3 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -596,6 +596,13 @@ trait StorageBase $this->assertEquals(201, $chunked['headers']['status-code']); $this->assertEquals('videos/2026/', $chunked['body']['parent']); $this->assertEquals('videos/2026/large-file.mp4', $chunked['body']['key']); + + $response = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertEquals(204, $response['headers']['status-code']); } public function testCreateBucketFileZstdCompression(): void @@ -2063,6 +2070,13 @@ trait StorageBase 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), ['parent' => '/photos']); $this->assertEquals(400, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertEquals(204, $response['headers']['status-code']); } public function testListFolders(): void @@ -2144,5 +2158,12 @@ trait StorageBase ], $this->getHeaders())); $this->assertEquals(204, $delete['headers']['status-code']); $this->assertEquals(['photos/2025/'], \array_column($listFolders(['parent' => 'photos']), 'key')); + + $response = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertEquals(204, $response['headers']['status-code']); } } diff --git a/tests/e2e/Services/Storage/StorageCustomClientTest.php b/tests/e2e/Services/Storage/StorageCustomClientTest.php index a851018e6d..1ddd8bd57c 100644 --- a/tests/e2e/Services/Storage/StorageCustomClientTest.php +++ b/tests/e2e/Services/Storage/StorageCustomClientTest.php @@ -1645,5 +1645,12 @@ final class StorageCustomClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(['shared/'], \array_column($response['body']['folders'], 'key')); + + $response = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertEquals(204, $response['headers']['status-code']); } } diff --git a/tests/unit/Utopia/Database/Validator/FolderTest.php b/tests/unit/Utopia/Database/Validator/FolderTest.php index d313526db9..d645788bb2 100644 --- a/tests/unit/Utopia/Database/Validator/FolderTest.php +++ b/tests/unit/Utopia/Database/Validator/FolderTest.php @@ -38,6 +38,7 @@ final class FolderTest extends TestCase $this->assertFalse($this->object->isValid('photos/./2026')); $this->assertFalse($this->object->isValid('photos/../2026')); $this->assertFalse($this->object->isValid('..')); + $this->assertFalse($this->object->isValid('.')); $this->assertFalse($this->object->isValid("photos/\x01")); $this->assertFalse($this->object->isValid("photos\n")); // 2048 chars without trailing slash normalizes to 2049 -- too long