1
0
Fork 0
mirror of synced 2024-10-02 10:16:27 +13:00

tests fix

This commit is contained in:
shimon 2023-11-26 22:57:57 +02:00
parent 7ee96fb118
commit c9a4eb0a49
7 changed files with 59 additions and 41 deletions

View file

@ -77,7 +77,7 @@ abstract class Migration
'1.4.10' => 'V19', '1.4.10' => 'V19',
'1.4.11' => 'V19', '1.4.11' => 'V19',
'1.4.12' => 'V19', '1.4.12' => 'V19',
'1.4.13' => 'V19' '1.4.13' => 'V19',
'1.4.14' => 'V20' '1.4.14' => 'V20'
]; ];

View file

@ -22,7 +22,6 @@ use Appwrite\Platform\Tasks\GetMigrationStats;
use Appwrite\Platform\Tasks\PatchRecreateRepositoriesDocuments; use Appwrite\Platform\Tasks\PatchRecreateRepositoriesDocuments;
use Appwrite\Platform\Tasks\CreateInfMetric; use Appwrite\Platform\Tasks\CreateInfMetric;
class Tasks extends Service class Tasks extends Service
{ {
public function __construct() public function __construct()

View file

@ -224,10 +224,12 @@ class DatabasesConsoleClientTest extends Scope
]); ]);
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(count($response['body']), 3); $this->assertEquals(5, count($response['body']));
$this->assertEquals($response['body']['range'], '24h'); $this->assertEquals('24h', $response['body']['range']);
$this->assertIsArray($response['body']['documentsTotal']); $this->assertIsNumeric($response['body']['documentsTotal']);
$this->assertIsArray($response['body']['collectionsTotal']); $this->assertIsNumeric($response['body']['collectionsTotal']);
$this->assertIsArray($response['body']['collections']);
$this->assertIsArray($response['body']['documents']);
} }
@ -269,9 +271,10 @@ class DatabasesConsoleClientTest extends Scope
'range' => '24h' 'range' => '24h'
]); ]);
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(count($response['body']), 2); $this->assertEquals(3, count($response['body']));
$this->assertEquals($response['body']['range'], '24h'); $this->assertEquals('24h', $response['body']['range']);
$this->assertIsArray($response['body']['documentsTotal']); $this->assertIsNumeric($response['body']['documentsTotal']);
$this->assertIsArray($response['body']['documents']);
} }
/** /**

View file

@ -91,15 +91,23 @@ class FunctionsConsoleClientTest extends Scope
'range' => '24h' 'range' => '24h'
]); ]);
$this->assertEquals($response['headers']['status-code'], 200); $this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(count($response['body']), 8); $this->assertEquals(15, count($response['body']));
$this->assertEquals($response['body']['range'], '24h'); $this->assertEquals('24h', $response['body']['range']);
$this->assertIsArray($response['body']['deploymentsTotal']); $this->assertIsNumeric($response['body']['deploymentsTotal']);
$this->assertIsNumeric($response['body']['deploymentsStorageTotal']);
$this->assertIsNumeric($response['body']['buildsTotal']);
$this->assertIsNumeric($response['body']['buildsStorageTotal']);
$this->assertIsNumeric($response['body']['buildsTimeTotal']);
$this->assertIsNumeric($response['body']['executionsTotal']);
$this->assertIsNumeric($response['body']['executionsTimeTotal']);
$this->assertIsArray($response['body']['deployments']);
$this->assertIsArray($response['body']['deploymentsStorage']); $this->assertIsArray($response['body']['deploymentsStorage']);
$this->assertIsArray($response['body']['buildsTotal']); $this->assertIsArray($response['body']['builds']);
$this->assertIsArray($response['body']['buildsTime']);
$this->assertIsArray($response['body']['buildsStorage']); $this->assertIsArray($response['body']['buildsStorage']);
$this->assertIsArray($response['body']['buildsTime']); $this->assertIsArray($response['body']['buildsTime']);
$this->assertIsArray($response['body']['executionsTotal']); $this->assertIsArray($response['body']['executions']);
$this->assertIsArray($response['body']['executionsTime']); $this->assertIsArray($response['body']['executionsTime']);
} }

View file

@ -451,17 +451,18 @@ class ProjectsConsoleClientTest extends Scope
], $this->getHeaders())); ], $this->getHeaders()));
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(count($response['body']), 9); $this->assertEquals(9, count($response['body']));
$this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']);
$this->assertEquals('30d', $response['body']['range']); $this->assertEquals('30d', $response['body']['range']);
$this->assertIsArray($response['body']['requestsTotal']); $this->assertIsArray($response['body']['requests']);
$this->assertIsArray($response['body']['network']); $this->assertIsArray($response['body']['network']);
$this->assertIsArray($response['body']['executionsTotal']); $this->assertIsNumeric($response['body']['executionsTotal']);
$this->assertIsArray($response['body']['documentsTotal']); $this->assertIsNumeric($response['body']['documentsTotal']);
$this->assertIsArray($response['body']['databasesTotal']); $this->assertIsNumeric($response['body']['databasesTotal']);
$this->assertIsArray($response['body']['bucketsTotal']); $this->assertIsNumeric($response['body']['bucketsTotal']);
$this->assertIsArray($response['body']['usersTotal']); $this->assertIsNumeric($response['body']['usersTotal']);
$this->assertIsArray($response['body']['filesStorage']); $this->assertIsNumeric($response['body']['filesStorageTotal']);
/** /**
* Test for FAILURE * Test for FAILURE

View file

@ -38,12 +38,15 @@ class StorageConsoleClientTest extends Scope
'range' => '24h' 'range' => '24h'
]); ]);
$this->assertEquals($response['headers']['status-code'], 200); $this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(4, count($response['body'])); $this->assertEquals(7, count($response['body']));
$this->assertEquals($response['body']['range'], '24h'); $this->assertEquals('24h', $response['body']['range']);
$this->assertIsArray($response['body']['bucketsTotal']); $this->assertIsNumeric($response['body']['bucketsTotal']);
$this->assertIsArray($response['body']['filesTotal']); $this->assertIsNumeric($response['body']['filesTotal']);
$this->assertIsArray($response['body']['filesStorage']); $this->assertIsNumeric($response['body']['filesStorageTotal']);
$this->assertIsArray($response['body']['buckets']);
$this->assertIsArray($response['body']['files']);
$this->assertIsArray($response['body']['storage']);
} }
public function testGetStorageBucketUsage() public function testGetStorageBucketUsage()
@ -71,7 +74,7 @@ class StorageConsoleClientTest extends Scope
'range' => '32h' 'range' => '32h'
]); ]);
$this->assertEquals($response['headers']['status-code'], 400); $this->assertEquals(400, $response['headers']['status-code']);
// TODO: Uncomment once we implement check for missing bucketId in the usage endpoint. // TODO: Uncomment once we implement check for missing bucketId in the usage endpoint.
@ -82,7 +85,7 @@ class StorageConsoleClientTest extends Scope
'range' => '24h' 'range' => '24h'
]); ]);
$this->assertEquals($response['headers']['status-code'], 404); $this->assertEquals(404, $response['headers']['status-code']);
/** /**
* Test for SUCCESS * Test for SUCCESS
@ -94,10 +97,12 @@ class StorageConsoleClientTest extends Scope
'range' => '24h' 'range' => '24h'
]); ]);
$this->assertEquals($response['headers']['status-code'], 200); $this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(count($response['body']), 3); $this->assertEquals(5, count($response['body']));
$this->assertEquals($response['body']['range'], '24h'); $this->assertEquals('24h', $response['body']['range']);
$this->assertIsArray($response['body']['filesTotal']); $this->assertIsNumeric($response['body']['filesTotal']);
$this->assertIsArray($response['body']['filesStorage']); $this->assertIsNumeric($response['body']['filesStorageTotal']);
$this->assertIsArray($response['body']['files']);
$this->assertIsArray($response['body']['storage']);
} }
} }

View file

@ -37,10 +37,12 @@ class UsersConsoleClientTest extends Scope
'range' => '24h', 'range' => '24h',
]); ]);
$this->assertEquals($response['headers']['status-code'], 200); $this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(count($response['body']), 3); $this->assertEquals(5, count($response['body']));
$this->assertEquals($response['body']['range'], '24h'); $this->assertEquals('24h', $response['body']['range']);
$this->assertIsArray($response['body']['usersTotal']); $this->assertIsNumeric($response['body']['usersTotal']);
$this->assertIsArray($response['body']['sessionsTotal']); $this->assertIsNumeric($response['body']['sessionsTotal']);
$this->assertIsArray($response['body']['users']);
$this->assertIsArray($response['body']['sessions']);
} }
} }