Simbrief attachment not working #1005 (#1006)

* Refactoring for Simbrief not working #1005

* Style fixes

* Update tests for new briefing URL

* Check the OFP user

* Comment out user check temporarily
This commit is contained in:
Nabeel S
2021-01-25 06:54:17 -05:00
committed by GitHub
parent 101b3261f5
commit fc7ad7eb6a
9 changed files with 102 additions and 48 deletions

View File

@@ -230,12 +230,18 @@ class AcarsTest extends TestCase
$this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false);
$this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false);
/** @var User user */
$this->user = factory(User::class)->create([
'curr_airport_id' => 'KJFK',
]);
/** @var Airport $airport */
$airport = factory(Airport::class)->create();
/** @var Airline $airline */
$airline = factory(Airline::class)->create();
/** @var Aircraft $aircraft */
$aircraft = factory(Aircraft::class)->create([
'airport_id' => 'KAUS',
]);

View File

@@ -423,14 +423,16 @@ class PIREPTest extends TestCase
// Submit two PIREPs
// 1 hour flight times, but the rank should bump up because of the transfer hours
/** @var Pirep $pirep */
$pirep = factory(Pirep::class)->create([
'airline_id' => $user->airline_id,
'user_id' => $user->id,
]);
$this->pirepSvc->create($pirep);
$this->pirepSvc->file($pirep);
$this->pirepSvc->submit($pirep);
/** @var User $user */
$user = User::find($user->id);
$this->assertEquals(UserState::ACTIVE, $user->state);
}

View File

@@ -23,8 +23,9 @@ class SimBriefTest extends TestCase
*
* @return \App\Models\SimBrief
*/
protected function loadSimBrief($user): SimBrief
protected function loadSimBrief(User $user): SimBrief
{
/** @var \App\Models\Flight $flight */
$flight = factory(Flight::class)->create([
'id' => self::$simbrief_flight_id,
'dpt_airport_id' => 'OMAA',
@@ -39,7 +40,7 @@ class SimBriefTest extends TestCase
/** @var SimBriefService $sb */
$sb = app(SimBriefService::class);
return $sb->checkForOfp($user->id, Utils::generateNewId(), $flight->id);
return $sb->downloadOfp($user->id, Utils::generateNewId(), $flight->id);
}
/**
@@ -99,14 +100,13 @@ class SimBriefTest extends TestCase
$url = str_replace('http://', 'https://', $flight['simbrief']['url']);
$this->assertEquals(
'https://localhost/api/flights/'.$briefing->flight_id.'/briefing',
'https://localhost/api/flights/'.$briefing->id.'/briefing',
$url
);
// Retrieve the briefing via API, and then check the doctype
$response = $this->get('/api/flights/'.$briefing->flight_id.'/briefing');
$response = $this->get('/api/flights/'.$briefing->id.'/briefing', [], $this->user);
$response->assertOk();
// $response->assertHeader('Content-Type', 'application/xml');
$xml = simplexml_load_string($response->content());
$this->assertNotNull($xml);