1
0
Fork 0
mirror of synced 2024-07-09 00:16:13 +12:00

fix usage test

This commit is contained in:
Damodar Lohani 2021-09-13 14:03:40 +05:45
parent 6d3a78f7a9
commit a3a97540f3

View file

@ -46,11 +46,22 @@ class StorageConsoleClientTest extends Scope
public function testGetStorageBucketUsage() public function testGetStorageBucketUsage()
{ {
//create bucket
$bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'bucketId' => 'unique()',
'name' => 'Test Bucket',
]);
$this->assertEquals(201, $bucket['headers']['status-code']);
$bucketId = $bucket['body']['$id'];
/** /**
* Test for FAILURE * Test for FAILURE
*/ */
$response = $this->client->call(Client::METHOD_GET, '/storage/default/usage', array_merge([ $response = $this->client->call(Client::METHOD_GET, '/storage/' . $bucketId . '/usage', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'] 'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()), [ ], $this->getHeaders()), [
@ -73,7 +84,7 @@ class StorageConsoleClientTest extends Scope
/** /**
* Test for SUCCESS * Test for SUCCESS
*/ */
$response = $this->client->call(Client::METHOD_GET, '/storage/default/usage', array_merge([ $response = $this->client->call(Client::METHOD_GET, '/storage/' . $bucketId . '/usage', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'] 'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()), [ ], $this->getHeaders()), [