Load Simbrief and flight data when getting bids #664 (#665)

This commit is contained in:
Nabeel S
2020-04-15 10:11:06 -04:00
committed by GitHub
parent b1bdd40da7
commit 8e97a7cc5c
3 changed files with 40 additions and 4 deletions

View File

@@ -9,6 +9,8 @@ use Carbon\Carbon;
class SimBriefTest extends TestCase
{
private static $simbrief_flight_id = 'simbriefflightid';
/**
* Load SimBrief
*
@@ -19,6 +21,7 @@ class SimBriefTest extends TestCase
protected function loadSimBrief($user): SimBrief
{
$flight = factory(App\Models\Flight::class)->create([
'id' => self::$simbrief_flight_id,
'dpt_airport_id' => 'OMAA',
'arr_airport_id' => 'OMDB',
]);
@@ -107,6 +110,25 @@ class SimBriefTest extends TestCase
$this->assertEquals('FlightPlan', $xml->attributes()->Type);
}
/**
* Make sure the user's bids have the Simbrief data show up
*/
public function testUserBidSimbrief()
{
$this->user = factory(App\Models\User::class)->create();
$this->loadSimBrief($this->user);
// Find the flight
$uri = '/api/user/bids';
$data = ['flight_id' => self::$simbrief_flight_id];
$body = $this->put($uri, $data);
$body = $body->json('data');
// Make sure Simbrief is there
$this->assertNotNull($body['flight']['simbrief']['id']);
}
public function testAttachToPirep()
{
$user = factory(App\Models\User::class)->create();