Add status API tests

This commit is contained in:
James Brooks 2019-02-19 07:30:28 +00:00
parent d32f5e1aea
commit 5157e67f50

View File

@ -11,6 +11,8 @@
namespace CachetHQ\Tests\Cachet\Api;
use CachetHQ\Cachet\Models\Component;
/**
* This is the general test class.
*
@ -42,4 +44,36 @@ class GeneralTest extends AbstractApiTestCase
$response->assertStatus(406);
}
public function test_can_get_system_status()
{
$response = $this->json('GET', '/api/v1/status');
$response->assertStatus(200)
->assertHeader('Cache-Control')
->assertJsonFragment([
'data' => [
'status' => 'success',
'message' => 'System operational'
]
]);
}
public function test_can_get_system_status_not_success()
{
factory(Component::class)->create([
'status' => 3,
]);
$response = $this->json('GET', '/api/v1/status');
$response->assertStatus(200)
->assertHeader('Cache-Control')
->assertJsonFragment([
'data' => [
'status' => 'info',
'message' => 'The system is experiencing issues'
]
]);
}
}