add: tests.

This commit is contained in:
Darshan
2026-01-07 18:05:33 +05:30
parent 9ba3f6dfe8
commit 47ea8699d1
2 changed files with 18 additions and 0 deletions
@@ -105,6 +105,16 @@ class StorageServerTest extends Scope
$buckets = $buckets['body']['data']['storageListBuckets'];
$this->assertIsArray($buckets);
if (!empty($buckets['buckets'])) {
foreach ($buckets['buckets'] as $bucket) {
$this->assertArrayHasKey('totalSize', $bucket);
$this->assertIsInt($bucket['totalSize']);
/* always 0 because the stats worker runs hourly! */
$this->assertGreaterThanOrEqual(0, $bucket['totalSize']);
}
}
return $buckets;
}
@@ -96,6 +96,14 @@ class StorageCustomServerTest extends Scope
$this->assertEquals($id, $response['body']['buckets'][0]['$id']);
$this->assertEquals('Test Bucket', $response['body']['buckets'][0]['name']);
foreach ($response['body']['buckets'] as $bucket) {
$this->assertArrayHasKey('totalSize', $bucket);
$this->assertIsInt($bucket['totalSize']);
/* always 0 because the stats worker runs hourly! */
$this->assertGreaterThanOrEqual(0, $bucket['totalSize']);
}
$response = $this->client->call(Client::METHOD_GET, '/storage/buckets', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],