Add testing of status code to API

This commit is contained in:
James Brooks
2015-06-03 08:28:48 +01:00
parent dd8fc60209
commit fad393be1d
3 changed files with 15 additions and 2 deletions
+3
View File
@@ -59,6 +59,7 @@ class ComponentTest extends AbstractTestCase
'group_id' => 1, 'group_id' => 1,
]); ]);
$this->seeJson(['name' => 'Foo']); $this->seeJson(['name' => 'Foo']);
$this->assertResponseOk();
} }
public function testGetNewComponent() public function testGetNewComponent()
@@ -67,6 +68,7 @@ class ComponentTest extends AbstractTestCase
$this->get('/api/v1/components/1'); $this->get('/api/v1/components/1');
$this->seeJson(['name' => $component->name]); $this->seeJson(['name' => $component->name]);
$this->assertResponseOk();
} }
public function testPutComponent() public function testPutComponent()
@@ -78,6 +80,7 @@ class ComponentTest extends AbstractTestCase
'name' => 'Foo', 'name' => 'Foo',
]); ]);
$this->seeJson(['name' => 'Foo']); $this->seeJson(['name' => 'Foo']);
$this->assertResponseOk();
} }
public function testDeleteComponent() public function testDeleteComponent()
+6 -1
View File
@@ -20,7 +20,9 @@ class IncidentTest extends AbstractTestCase
public function testGetIncidents() public function testGetIncidents()
{ {
$this->get('/api/v1/incidents')->seeJson(['data' => []]); $this->get('/api/v1/incidents');
$this->seeJson(['data' => []]);
$this->assertResponseOk();
} }
public function testGetInvalidIncident() public function testGetInvalidIncident()
@@ -54,6 +56,7 @@ class IncidentTest extends AbstractTestCase
'status' => 1, 'status' => 1,
]); ]);
$this->seeJson(['name' => 'Foo']); $this->seeJson(['name' => 'Foo']);
$this->assertResponseOk();
} }
public function testGetNewIncident() public function testGetNewIncident()
@@ -62,6 +65,7 @@ class IncidentTest extends AbstractTestCase
$this->get('/api/v1/incidents/1'); $this->get('/api/v1/incidents/1');
$this->seeJson(['name' => $incident->name]); $this->seeJson(['name' => $incident->name]);
$this->assertResponseOk();
} }
public function testPutIncident() public function testPutIncident()
@@ -73,6 +77,7 @@ class IncidentTest extends AbstractTestCase
'name' => 'Foo', 'name' => 'Foo',
]); ]);
$this->seeJson(['name' => 'Foo']); $this->seeJson(['name' => 'Foo']);
$this->assertResponseOk();
} }
public function testDeleteIncident() public function testDeleteIncident()
+6 -1
View File
@@ -20,7 +20,9 @@ class MetricTest extends AbstractTestCase
public function testGetMetrics() public function testGetMetrics()
{ {
$this->get('/api/v1/metrics')->seeJson(['data' => []]); $this->get('/api/v1/metrics');
$this->seeJson(['data' => []]);
$this->assertResponseOk();
} }
public function testGetInvalidMetric() public function testGetInvalidMetric()
@@ -56,6 +58,7 @@ class MetricTest extends AbstractTestCase
'display_chart' => 1, 'display_chart' => 1,
]); ]);
$this->seeJson(['name' => 'Foo']); $this->seeJson(['name' => 'Foo']);
$this->assertResponseOk();
} }
public function testGetNewMetric() public function testGetNewMetric()
@@ -64,6 +67,7 @@ class MetricTest extends AbstractTestCase
$this->get('/api/v1/metrics/1'); $this->get('/api/v1/metrics/1');
$this->seeJson(['name' => $incident->name]); $this->seeJson(['name' => $incident->name]);
$this->assertResponseOk();
} }
public function testPutMetric() public function testPutMetric()
@@ -75,6 +79,7 @@ class MetricTest extends AbstractTestCase
'name' => 'Foo', 'name' => 'Foo',
]); ]);
$this->seeJson(['name' => 'Foo']); $this->seeJson(['name' => 'Foo']);
$this->assertResponseOk();
} }
public function testDeleteMetric() public function testDeleteMetric()