Overhaul of ACARS/PIREP APIs

This commit is contained in:
Nabeel Shahzad
2018-01-04 19:33:23 -06:00
parent f4e3964f9d
commit b62fa7757c
10 changed files with 491 additions and 86 deletions

View File

@@ -193,10 +193,13 @@ class PIREPTest extends TestCase
$response = $this->withHeaders($this->apiHeaders())->post($uri, $pirep);
$pirep_id = $response->json()['id'];
$uri = '/api/pireps/' . $pirep_id . '/acars';
$uri = '/api/pireps/' . $pirep_id . '/acars/position';
$acars = factory(App\Models\Acars::class)->make()->toArray();
$response = $this->withHeaders($this->apiHeaders())->post($uri, $acars);
$response->assertStatus(201);
$response = $this->withHeaders($this->apiHeaders())->post($uri, [
'positions' => [$acars]
]);
$response->assertStatus(200);
# Cancel it
$uri = '/api/pireps/' . $pirep_id . '/cancel';
@@ -204,7 +207,7 @@ class PIREPTest extends TestCase
$response->assertStatus(200);
# Should get a 400 when posting an ACARS update
$uri = '/api/pireps/' . $pirep_id . '/acars';
$uri = '/api/pireps/' . $pirep_id . '/acars/position';
$acars = factory(App\Models\Acars::class)->make()->toArray();
$response = $this->withHeaders($this->apiHeaders())->post($uri, $acars);
$response->assertStatus(400);