mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
added tests
This commit is contained in:
1 parent
1daf39c737
commit
8d1c57d0e7
1 file changed
+39
@@ -776,6 +776,45 @@ trait DatabasesBase
|
||||
$this->assertEquals($this->getDatabaseType(), $database['body']['type']);
|
||||
}
|
||||
|
||||
public function testDatabaseStatus(): void
|
||||
{
|
||||
if ($this->getSide() === 'client') {
|
||||
// Databases are created and read with a server API key.
|
||||
$this->expectNotToPerformAssertions();
|
||||
return;
|
||||
}
|
||||
|
||||
$headers = [
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Test for SUCCESS
|
||||
* A newly created database defaults to the "ready" status.
|
||||
*/
|
||||
$database = $this->client->call(Client::METHOD_POST, $this->getApiBasePath(), $headers, [
|
||||
'databaseId' => ID::unique(),
|
||||
'name' => 'Status Database',
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $database['headers']['status-code']);
|
||||
$this->assertArrayHasKey('status', $database['body']);
|
||||
$this->assertEquals('ready', $database['body']['status']);
|
||||
|
||||
$databaseId = $database['body']['$id'];
|
||||
|
||||
/**
|
||||
* The status is persisted and returned on read.
|
||||
*/
|
||||
$response = $this->client->call(Client::METHOD_GET, $this->getApiBasePath() . '/' . $databaseId, $headers);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertArrayHasKey('status', $response['body']);
|
||||
$this->assertEquals('ready', $response['body']['status']);
|
||||
}
|
||||
|
||||
public function testCreateCollection(): void
|
||||
{
|
||||
$data = $this->setupDatabase();
|
||||
|
||||
Reference in new issue
Block a user