From 7d5e073812b18f2167e51c86356a393355b35067 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 16 Jun 2021 11:36:09 +0545 Subject: [PATCH] remove buckets test from base in favor for server side tests --- tests/e2e/Services/Storage/StorageBase.php | 93 ---------------------- 1 file changed, 93 deletions(-) diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index 657bda16e..508866b6a 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -242,97 +242,4 @@ trait StorageBase return $data; } - - public function testCreateBucket():array - { - /** - * Test for SUCCESS - */ - $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'name' => 'Test Bucket', - ]); - $this->assertEquals(201, $bucket['headers']['status-code']); - $this->assertNotEmpty($bucket['body']['$id']); - $this->assertIsInt($bucket['body']['dateCreated']); - $this->assertEquals('Test Bucket', $bucket['body']['name']); - $this->assertEquals(true, $bucket['body']['enabled']); - $bucketId = $bucket['body']['$id']; - /** - * Test for FAILURE - */ - $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'name' => '', - ]); - $this->assertEquals(400, $bucket['headers']['status-code']); - - return ['bucketId' => $bucketId]; - } - - /** - * @depends testCreateBucket - */ - public function testListBucket($data): array - { - $id = $data['bucketId'] ?? ''; - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/storage/buckets', - array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertNotEmpty($response['body']); - $this->assertEquals($id, $response['body']['buckets'][0]['$id']); - $this->assertEquals('Test Bucket', $response['body']['buckets'][0]['name']); - - return $data; - } - - /** - * @depends testCreateBucket - */ - public function testGetBucket($data): array - { - $id = $data['bucketId'] ?? ''; - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $id, - array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertNotEmpty($response['body']); - $this->assertEquals($id, $response['body']['$id']); - $this->assertEquals('Test Bucket', $response['body']['name']); - - /** - * Test for FAILURE - */ - - $response = $this->client->call(Client::METHOD_GET, '/storage/buckets/empty', - array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals(404, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_GET, '/storage/buckets/id-is-really-long-id-is-really-long-id-is-really-long-id-is-really-long', - array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals(400, $response['headers']['status-code']); - - return $data; - } } \ No newline at end of file