Change the api test to call pirep api
This commit is contained in:
@@ -20,9 +20,9 @@ class ApiTest extends TestCase
|
|||||||
public function testApiAuthentication()
|
public function testApiAuthentication()
|
||||||
{
|
{
|
||||||
$user = factory(User::class)->create();
|
$user = factory(User::class)->create();
|
||||||
$airport = factory(App\Models\Airport::class)->create();
|
$pirep = factory(App\Models\Pirep::class)->create();
|
||||||
|
|
||||||
$uri = '/api/airports/' . $airport->icao;
|
$uri = '/api/pireps/' . $pirep->id;
|
||||||
|
|
||||||
// Missing auth header
|
// Missing auth header
|
||||||
$this->get($uri)->assertStatus(401);
|
$this->get($uri)->assertStatus(401);
|
||||||
@@ -37,19 +37,19 @@ class ApiTest extends TestCase
|
|||||||
// Test upper/lower case of Authorization header, etc
|
// Test upper/lower case of Authorization header, etc
|
||||||
$this->withHeaders($this->apiHeaders())->get($uri)
|
$this->withHeaders($this->apiHeaders())->get($uri)
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertJson(['icao' => $airport->icao], true);
|
->assertJson(['id' => $pirep->id], true);
|
||||||
|
|
||||||
$this->withHeaders(['x-api-key' => $user->api_key])->get($uri)
|
$this->withHeaders(['x-api-key' => $user->api_key])->get($uri)
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertJson(['icao' => $airport->icao], true);
|
->assertJson(['id' => $pirep->id], true);
|
||||||
|
|
||||||
$this->withHeaders(['x-API-key' => $user->api_key])->get($uri)
|
$this->withHeaders(['x-API-key' => $user->api_key])->get($uri)
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertJson(['icao' => $airport->icao], true);
|
->assertJson(['id' => $pirep->id], true);
|
||||||
|
|
||||||
$this->withHeaders(['X-API-KEY' => $user->api_key])->get($uri)
|
$this->withHeaders(['X-API-KEY' => $user->api_key])->get($uri)
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertJson(['icao' => $airport->icao], true);
|
->assertJson(['id' => $pirep->id], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user