Remove repositories from the API and switch cipher to rijndael-256
This commit is contained in:
committed by
James Brooks
parent
d788691006
commit
106c1a034a
@@ -20,8 +20,12 @@ class ComponentTest extends AbstractTestCase
|
||||
|
||||
public function testGetComponents()
|
||||
{
|
||||
$components = factory('CachetHQ\Cachet\Models\Component', 3)->create();
|
||||
|
||||
$this->get('/api/v1/components');
|
||||
$this->seeJson(['data' => []]);
|
||||
$this->seeJson(['id' => (string) $components[0]->id]);
|
||||
$this->seeJson(['id' => (string) $components[1]->id]);
|
||||
$this->seeJson(['id' => (string) $components[2]->id]);
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,14 +20,18 @@ class IncidentTest extends AbstractTestCase
|
||||
|
||||
public function testGetIncidents()
|
||||
{
|
||||
$incidents = factory('CachetHQ\Cachet\Models\Incident', 3)->create();
|
||||
|
||||
$this->get('/api/v1/incidents');
|
||||
$this->seeJson(['data' => []]);
|
||||
$this->seeJson(['id' => (string) $incidents[0]->id]);
|
||||
$this->seeJson(['id' => (string) $incidents[1]->id]);
|
||||
$this->seeJson(['id' => (string) $incidents[2]->id]);
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function testGetInvalidIncident()
|
||||
{
|
||||
$this->get('/api/v1/incidents/1');
|
||||
$this->get('/api/v1/incidents/0');
|
||||
$this->assertResponseStatus(404);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,26 @@ class MetricPointTest extends AbstractTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
public function testGetMetricPoint()
|
||||
{
|
||||
$metric = factory('CachetHQ\Cachet\Models\Metric')->create();
|
||||
$metricPoint = factory('CachetHQ\Cachet\Models\MetricPoint', 3)->create([
|
||||
'metric_id' => $metric->id,
|
||||
]);
|
||||
|
||||
$this->get("/api/v1/metrics/{$metric->id}/points");
|
||||
$this->seeJson(['id' => (string) $metricPoint[0]->id]);
|
||||
$this->seeJson(['id' => (string) $metricPoint[1]->id]);
|
||||
$this->seeJson(['id' => (string) $metricPoint[2]->id]);
|
||||
}
|
||||
|
||||
public function testPostMetricPointUnauthorized()
|
||||
{
|
||||
$metricPoint = factory('CachetHQ\Cachet\Models\MetricPoint')->create();
|
||||
$this->post('/api/v1/metrics/1/points');
|
||||
$metric = factory('CachetHQ\Cachet\Models\Metric')->create();
|
||||
$metricPoint = factory('CachetHQ\Cachet\Models\MetricPoint')->create([
|
||||
'metric_id' => $metric->id,
|
||||
]);
|
||||
$this->post("/api/v1/metrics/{$metric->id}/points");
|
||||
|
||||
$this->assertResponseStatus(401);
|
||||
$this->seeJson(['message' => 'You are not authorized to view this content.', 'status_code' => 401]);
|
||||
@@ -30,17 +46,24 @@ class MetricPointTest extends AbstractTestCase
|
||||
public function testPostMetricPoint()
|
||||
{
|
||||
$this->beUser();
|
||||
$metricPoint = factory('CachetHQ\Cachet\Models\MetricPoint')->create();
|
||||
|
||||
$this->post('/api/v1/metrics/1/points', $metricPoint->toArray());
|
||||
$metric = factory('CachetHQ\Cachet\Models\Metric')->create();
|
||||
$metricPoint = factory('CachetHQ\Cachet\Models\MetricPoint')->make([
|
||||
'metric_id' => $metric->id,
|
||||
]);
|
||||
|
||||
$this->post("/api/v1/metrics/{$metric->id}/points", $metricPoint->toArray());
|
||||
$this->seeJson(['value' => (string) $metricPoint->value]);
|
||||
}
|
||||
|
||||
public function testPutMetricPoint()
|
||||
{
|
||||
$this->beUser();
|
||||
$metricPoint = factory('CachetHQ\Cachet\Models\MetricPoint')->create();
|
||||
$this->put('/api/v1/metrics/1/points/1', [
|
||||
$metric = factory('CachetHQ\Cachet\Models\Metric')->create();
|
||||
$metricPoint = factory('CachetHQ\Cachet\Models\MetricPoint')->create([
|
||||
'metric_id' => $metric->id,
|
||||
]);
|
||||
$this->put("/api/v1/metrics/{$metric->id}/points/{$metricPoint->id}", [
|
||||
'value' => 999,
|
||||
]);
|
||||
$this->seeJson(['value' => '999']);
|
||||
@@ -49,8 +72,11 @@ class MetricPointTest extends AbstractTestCase
|
||||
public function testDeleteMetricPoint()
|
||||
{
|
||||
$this->beUser();
|
||||
$metricPoint = factory('CachetHQ\Cachet\Models\MetricPoint')->create();
|
||||
$this->delete('/api/v1/metrics/1/points/1');
|
||||
$metric = factory('CachetHQ\Cachet\Models\Metric')->create();
|
||||
$metricPoint = factory('CachetHQ\Cachet\Models\MetricPoint')->create([
|
||||
'metric_id' => $metric->id,
|
||||
]);
|
||||
$this->delete("/api/v1/metrics/{$metric->id}/points/{$metricPoint->id}");
|
||||
$this->assertResponseStatus(204);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,18 @@ class MetricTest extends AbstractTestCase
|
||||
|
||||
public function testGetMetrics()
|
||||
{
|
||||
$metrics = factory('CachetHQ\Cachet\Models\Metric', 3)->create();
|
||||
|
||||
$this->get('/api/v1/metrics');
|
||||
$this->seeJson(['data' => []]);
|
||||
$this->seeJson(['id' => (string) $metrics[0]->id]);
|
||||
$this->seeJson(['id' => (string) $metrics[1]->id]);
|
||||
$this->seeJson(['id' => (string) $metrics[2]->id]);
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function testGetInvalidMetric()
|
||||
{
|
||||
$this->get('/api/v1/metrics/1');
|
||||
$this->get('/api/v1/metrics/0');
|
||||
$this->assertResponseStatus(404);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user