Don't return bids by default, fix user flight column #639 (#640)

Fix the user api response, don't return bids by default, fix flights column #639
This commit is contained in:
Nabeel S
2020-03-25 18:04:26 -04:00
committed by GitHub
parent 88e8ea6ed1
commit f3fe3a56ba
7 changed files with 30 additions and 25 deletions

View File

@@ -73,12 +73,12 @@ class BidTest extends TestCase
// Query the API and see that the user has the bids
// And pull the flight details for the user/bids
$req = $this->get('/api/user', $headers);
$req = $this->get('/api/user/bids', $headers);
$req->assertStatus(200);
$body = $req->json()['data'];
$this->assertCount(1, $body['bids']);
$this->assertEquals($flight->id, $body['bids'][0]['flight_id']);
$req->assertStatus(200);
$this->assertEquals($flight->id, $body[0]['flight_id']);
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
@@ -109,17 +109,15 @@ class BidTest extends TestCase
$bids = $user->bids()->get();
$this->assertTrue($bids->isEmpty());
$req = $this->get('/api/user', $headers);
$req = $this->get('/api/user/bids', $headers);
$req->assertStatus(200);
$body = $req->json()['data'];
$this->assertEquals($user->id, $body['id']);
$this->assertCount(0, $body['bids']);
$this->assertCount(0, $body);
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
$req->assertStatus(200);
$body = $req->json()['data'];
$this->assertCount(0, $body);
}
@@ -196,12 +194,11 @@ class BidTest extends TestCase
// Query the API and see that the user has the bids
// And pull the flight details for the user/bids
$req = $this->get('/api/user', $headers);
$req = $this->get('/api/user/bids', $headers);
$req->assertStatus(200);
$body = $req->json()['data'];
$this->assertEquals($user->id, $body['id']);
$this->assertCount(0, $body['bids']);
$this->assertCount(0, $body);
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
$req->assertStatus(200);

View File

@@ -84,8 +84,8 @@ class PIREPTest extends TestCase
/**
* Now set the PIREP state to ACCEPTED
*/
$new_pirep_count = $pirep->pilot->flights + 1;
$new_flight_time = $pirep->pilot->flight_time + $pirep->flight_time;
$new_pirep_count = $pirep->user->flights + 1;
$new_flight_time = $pirep->user->flight_time + $pirep->flight_time;
$this->pirepSvc->changeState($pirep, PirepState::ACCEPTED);
$this->assertEquals($new_pirep_count, $pirep->pilot->flights);