Change tests to use generated user

This commit is contained in:
Nabeel Shahzad
2018-01-04 21:05:26 -06:00
parent 265fb235f2
commit db3c60987e
8 changed files with 60 additions and 40 deletions

View File

@@ -70,13 +70,17 @@ class ApiTest extends TestCase
*/
public function testAirportRequest()
{
$user = factory(App\Models\User::class)->create();
$airport = factory(App\Models\Airport::class)->create();
$response = $this->withHeaders($this->apiHeaders())->get('/api/airports/' . $airport->icao);
$response = $this->withHeaders($this->headers($user))
->get('/api/airports/' . $airport->icao);
$response->assertStatus(200);
$response->assertJson(['icao' => $airport->icao], true);
$this->withHeaders($this->apiHeaders())->get('/api/airports/UNK')
$this->withHeaders($this->headers($user))
->get('/api/airports/UNK')
->assertStatus(404);
}
}