Admin cleanup
This commit is contained in:
@@ -81,6 +81,71 @@ def test_public_boards_include_todays_flights(client, db):
|
||||
}
|
||||
|
||||
|
||||
def test_public_boards_include_current_local_flight_statuses(client, db):
|
||||
now = datetime.now().replace(microsecond=0)
|
||||
ground_local = LocalFlight(
|
||||
registration="G-GRND",
|
||||
type="C152",
|
||||
callsign="GGRND",
|
||||
pob=1,
|
||||
flight_type=LocalFlightType.LOCAL,
|
||||
status=LocalFlightStatus.GROUND,
|
||||
created_dt=now,
|
||||
etd=now,
|
||||
)
|
||||
airborne_local = LocalFlight(
|
||||
registration="G-AIR1",
|
||||
type="PA28",
|
||||
callsign="GAIR1",
|
||||
pob=2,
|
||||
flight_type=LocalFlightType.LOCAL,
|
||||
status=LocalFlightStatus.LOCAL,
|
||||
created_dt=now,
|
||||
etd=now,
|
||||
takeoff_dt=now,
|
||||
duration=45,
|
||||
)
|
||||
circuit_local = LocalFlight(
|
||||
registration="G-CCT1",
|
||||
type="C152",
|
||||
callsign="GCCT1",
|
||||
pob=1,
|
||||
flight_type=LocalFlightType.CIRCUITS,
|
||||
status=LocalFlightStatus.CIRCUIT,
|
||||
created_dt=now,
|
||||
etd=now,
|
||||
takeoff_dt=now,
|
||||
duration=30,
|
||||
)
|
||||
landed_local = LocalFlight(
|
||||
registration="G-LND1",
|
||||
type="C172",
|
||||
callsign="GLND1",
|
||||
pob=1,
|
||||
flight_type=LocalFlightType.LOCAL,
|
||||
status=LocalFlightStatus.LANDED,
|
||||
created_dt=now,
|
||||
etd=now,
|
||||
takeoff_dt=now,
|
||||
landed_dt=now,
|
||||
)
|
||||
db.add_all([ground_local, airborne_local, circuit_local, landed_local])
|
||||
db.commit()
|
||||
|
||||
arrivals = client.get("/api/v1/public/arrivals")
|
||||
departures = client.get("/api/v1/public/departures")
|
||||
|
||||
assert arrivals.status_code == 200
|
||||
assert {
|
||||
item["ac_reg"] for item in arrivals.json() if item.get("isLocalFlight")
|
||||
} == {"G-AIR1", "G-CCT1"}
|
||||
|
||||
assert departures.status_code == 200
|
||||
assert {
|
||||
item["ac_reg"] for item in departures.json() if item.get("isLocalFlight")
|
||||
} == {"G-GRND"}
|
||||
|
||||
|
||||
def test_public_reference_lookups_return_seeded_records(client, db):
|
||||
db.add(
|
||||
Airport(
|
||||
|
||||
Reference in New Issue
Block a user