def test_filled_flight(db_session, client): lva = clubs.lva() john = users.john(club=lva) jane = users.jane() flight = flights.filled( pilot=john, pilot_name=u"johnny_d", co_pilot=jane, co_pilot_name=u"jane", club=lva, model=aircraft_models.nimeta(), takeoff_airport=airports.meiersberg(), landing_airport=airports.merzbrueck(), igc_file=igcs.filled(owner=john), ) add_fixtures(db_session, flight, traces.olc_classic(flight=flight)) res = client.get("/flights/{id}".format(id=flight.id)) assert res.status_code == 200 assert res.json == { u"flight": { u"id": flight.id, u"timeCreated": u"2016-12-30T11:23:45+00:00", u"pilot": { u"id": john.id, u"name": u"John Doe" }, u"pilotName": u"johnny_d", u"copilot": { u"id": jane.id, u"name": u"Jane Doe" }, u"copilotName": u"jane", u"club": { u"id": lva.id, u"name": u"LV Aachen" }, u"model": { u"id": flight.model_id, u"name": u"Nimeta", u"type": u"glider", u"index": 112, }, u"registration": u"D-1234", u"competitionId": u"701", u"scoreDate": u"2011-06-18", u"takeoffTime": u"2016-12-30T11:12:23+00:00", u"scoreStartTime": u"2016-12-30T11:17:23+00:00", u"scoreEndTime": u"2016-12-30T16:04:40+00:00", u"landingTime": u"2016-12-30T16:15:40+00:00", u"takeoffAirport": { u"id": flight.takeoff_airport.id, u"name": u"Meiersberg", u"countryCode": u"DE", }, u"landingAirport": { u"id": flight.landing_airport.id, u"name": u"Aachen Merzbruck", u"countryCode": u"DE", }, u"distance": 512, u"triangleDistance": 432, u"rawScore": 799.0, u"score": 713.3928571428571, u"speed": 30.84579717542964, u"privacyLevel": 0, u"igcFile": { u"owner": { u"id": john.id, u"name": u"John Doe" }, u"filename": u"abc1234d.igc", u"registration": u"D-4449", u"competitionId": u"TH", u"model": u"Hornet", u"date": u"2017-01-15", }, } }
def test_filled_flight(db_session, client): lva = clubs.lva() john = users.john(club=lva) jane = users.jane() flight = flights.filled( pilot=john, pilot_name=u'johnny_d', co_pilot=jane, co_pilot_name=u'jane', club=lva, model=aircraft_models.nimeta(), takeoff_airport=airports.meiersberg(), landing_airport=airports.merzbrueck(), igc_file=igcs.filled(owner=john) ) add_fixtures(db_session, flight, traces.olc_classic(flight=flight)) res = client.get('/flights/{id}'.format(id=flight.id)) assert res.status_code == 200 assert res.json == { u'flight': { u'id': flight.id, u'timeCreated': u'2016-12-30T11:23:45+00:00', u'pilot': { u'id': john.id, u'name': u'John Doe' }, u'pilotName': u'johnny_d', u'copilot': { u'id': jane.id, u'name': u'Jane Doe' }, u'copilotName': u'jane', u'club': { u'id': lva.id, u'name': u'LV Aachen', }, u'model': { u'id': flight.model_id, u'name': u'Nimeta', u'type': u'glider', u'index': 112, }, u'registration': u'D-1234', u'competitionId': u'701', u'scoreDate': u'2011-06-18', u'takeoffTime': u'2016-12-30T11:12:23+00:00', u'scoreStartTime': u'2016-12-30T11:17:23+00:00', u'scoreEndTime': u'2016-12-30T16:04:40+00:00', u'landingTime': u'2016-12-30T16:15:40+00:00', u'takeoffAirport': { u'id': flight.takeoff_airport.id, u'name': u'Meiersberg', u'countryCode': u'DE' }, u'landingAirport': { u'id': flight.landing_airport.id, u'name': u'Aachen Merzbruck', u'countryCode': u'DE', }, u'distance': 512, u'triangleDistance': 432, u'rawScore': 799.0, u'score': 713.0, u'speed': 30.84579717542964, u'privacyLevel': 0, u'igcFile': { u'owner': { u'id': john.id, u'name': u'John Doe' }, u'filename': u'abc1234d.igc', u'registration': u'D-4449', u'competitionId': u'TH', u'model': u'Hornet', u'date': u'2017-01-15', }, } }
def test_filled_flight(db_session, client): lva = clubs.lva() john = users.john(club=lva) jane = users.jane() flight = flights.filled(pilot=john, pilot_name='johnny_d', co_pilot=jane, co_pilot_name='jane', club=lva, model=aircraft_models.nimeta(), takeoff_airport=airports.meiersberg(), landing_airport=airports.merzbrueck(), igc_file=igcs.filled(owner=john)) add_fixtures(db_session, flight, traces.olc_classic(flight=flight)) res = client.get('/flights/{id}'.format(id=flight.id)) assert res.status_code == 200 assert res.json == { u'flight': { u'id': flight.id, u'timeCreated': u'2016-12-30T11:23:45+00:00', u'pilot': { u'id': john.id, u'name': u'John Doe' }, u'pilotName': u'johnny_d', u'copilot': { u'id': jane.id, u'name': u'Jane Doe' }, u'copilotName': u'jane', u'club': { u'id': lva.id, u'name': u'LV Aachen', }, u'model': { u'id': flight.model_id, u'name': u'Nimeta', u'type': u'glider', u'index': 112, }, u'registration': u'D-1234', u'competitionId': u'701', u'scoreDate': u'2011-06-18', u'takeoffTime': u'2016-12-30T11:12:23+00:00', u'scoreStartTime': u'2016-12-30T11:17:23+00:00', u'scoreEndTime': u'2016-12-30T16:04:40+00:00', u'landingTime': u'2016-12-30T16:15:40+00:00', u'takeoffAirport': { u'id': flight.takeoff_airport.id, u'name': u'Meiersberg', u'countryCode': u'DE' }, u'landingAirport': { u'id': flight.landing_airport.id, u'name': u'Aachen Merzbruck', u'countryCode': u'DE', }, u'distance': 512, u'triangleDistance': 432, u'rawScore': 799.0, u'score': 713.0, u'speed': 30.84579717542964, u'privacyLevel': 0, u'igcFile': { u'owner': { u'id': john.id, u'name': u'John Doe' }, u'filename': u'abc1234d.igc', u'registration': u'D-4449', u'competitionId': u'TH', u'model': u'Hornet', u'date': u'2017-01-15', }, } }
def test_filled_flight(db_session, client): lva = clubs.lva() john = users.john(club=lva) jane = users.jane() flight = flights.filled( pilot=john, pilot_name=u"johnny_d", co_pilot=jane, co_pilot_name=u"jane", club=lva, model=aircraft_models.nimeta(), takeoff_airport=airports.meiersberg(), landing_airport=airports.merzbrueck(), igc_file=igcs.filled(owner=john), ) add_fixtures(db_session, flight, traces.olc_classic(flight=flight)) res = client.get("/flights/{id}".format(id=flight.id)) assert res.status_code == 200 assert res.json == { u"flight": { u"id": flight.id, u"timeCreated": u"2016-12-30T11:23:45+00:00", u"pilot": {u"id": john.id, u"name": u"John Doe"}, u"pilotName": u"johnny_d", u"copilot": {u"id": jane.id, u"name": u"Jane Doe"}, u"copilotName": u"jane", u"club": {u"id": lva.id, u"name": u"LV Aachen"}, u"model": { u"id": flight.model_id, u"name": u"Nimeta", u"type": u"glider", u"index": 112, }, u"registration": u"D-1234", u"competitionId": u"701", u"scoreDate": u"2011-06-18", u"takeoffTime": u"2016-12-30T11:12:23+00:00", u"scoreStartTime": u"2016-12-30T11:17:23+00:00", u"scoreEndTime": u"2016-12-30T16:04:40+00:00", u"landingTime": u"2016-12-30T16:15:40+00:00", u"takeoffAirport": { u"id": flight.takeoff_airport.id, u"name": u"Meiersberg", u"countryCode": u"DE", }, u"landingAirport": { u"id": flight.landing_airport.id, u"name": u"Aachen Merzbruck", u"countryCode": u"DE", }, u"distance": 512, u"triangleDistance": 432, u"rawScore": 799.0, u"score": 713.3928571428571, u"speed": 30.84579717542964, u"privacyLevel": 0, u"igcFile": { u"owner": {u"id": john.id, u"name": u"John Doe"}, u"filename": u"abc1234d.igc", u"registration": u"D-4449", u"competitionId": u"TH", u"model": u"Hornet", u"date": u"2017-01-15", }, } }