mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 13:38:20 +01:00
Add status API tests
This commit is contained in:
parent
d32f5e1aea
commit
5157e67f50
@ -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'
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user