From fad393be1d8922e574469dbd1f0eac5acd189015 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 3 Jun 2015 08:28:48 +0100 Subject: [PATCH] Add testing of status code to API --- tests/Api/ComponentTest.php | 3 +++ tests/Api/IncidentTest.php | 7 ++++++- tests/Api/MetricTest.php | 7 ++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/Api/ComponentTest.php b/tests/Api/ComponentTest.php index 8f7854d3..b18e8964 100644 --- a/tests/Api/ComponentTest.php +++ b/tests/Api/ComponentTest.php @@ -59,6 +59,7 @@ class ComponentTest extends AbstractTestCase 'group_id' => 1, ]); $this->seeJson(['name' => 'Foo']); + $this->assertResponseOk(); } public function testGetNewComponent() @@ -67,6 +68,7 @@ class ComponentTest extends AbstractTestCase $this->get('/api/v1/components/1'); $this->seeJson(['name' => $component->name]); + $this->assertResponseOk(); } public function testPutComponent() @@ -78,6 +80,7 @@ class ComponentTest extends AbstractTestCase 'name' => 'Foo', ]); $this->seeJson(['name' => 'Foo']); + $this->assertResponseOk(); } public function testDeleteComponent() diff --git a/tests/Api/IncidentTest.php b/tests/Api/IncidentTest.php index 045590d0..fef61d83 100644 --- a/tests/Api/IncidentTest.php +++ b/tests/Api/IncidentTest.php @@ -20,7 +20,9 @@ class IncidentTest extends AbstractTestCase public function testGetIncidents() { - $this->get('/api/v1/incidents')->seeJson(['data' => []]); + $this->get('/api/v1/incidents'); + $this->seeJson(['data' => []]); + $this->assertResponseOk(); } public function testGetInvalidIncident() @@ -54,6 +56,7 @@ class IncidentTest extends AbstractTestCase 'status' => 1, ]); $this->seeJson(['name' => 'Foo']); + $this->assertResponseOk(); } public function testGetNewIncident() @@ -62,6 +65,7 @@ class IncidentTest extends AbstractTestCase $this->get('/api/v1/incidents/1'); $this->seeJson(['name' => $incident->name]); + $this->assertResponseOk(); } public function testPutIncident() @@ -73,6 +77,7 @@ class IncidentTest extends AbstractTestCase 'name' => 'Foo', ]); $this->seeJson(['name' => 'Foo']); + $this->assertResponseOk(); } public function testDeleteIncident() diff --git a/tests/Api/MetricTest.php b/tests/Api/MetricTest.php index 09fe0ff0..515866bb 100644 --- a/tests/Api/MetricTest.php +++ b/tests/Api/MetricTest.php @@ -20,7 +20,9 @@ class MetricTest extends AbstractTestCase public function testGetMetrics() { - $this->get('/api/v1/metrics')->seeJson(['data' => []]); + $this->get('/api/v1/metrics'); + $this->seeJson(['data' => []]); + $this->assertResponseOk(); } public function testGetInvalidMetric() @@ -56,6 +58,7 @@ class MetricTest extends AbstractTestCase 'display_chart' => 1, ]); $this->seeJson(['name' => 'Foo']); + $this->assertResponseOk(); } public function testGetNewMetric() @@ -64,6 +67,7 @@ class MetricTest extends AbstractTestCase $this->get('/api/v1/metrics/1'); $this->seeJson(['name' => $incident->name]); + $this->assertResponseOk(); } public function testPutMetric() @@ -75,6 +79,7 @@ class MetricTest extends AbstractTestCase 'name' => 'Foo', ]); $this->seeJson(['name' => 'Foo']); + $this->assertResponseOk(); } public function testDeleteMetric()