def testTrondheimData(self):
        xml_data = open("testdata/shortairlinelist.xml").read()
        
        airlines = AirlineParser.parse_airlines(xml_data)
        self.assertEqual(3, len(airlines))
        
        expected = [ ("AA", "American Airlines"),
                     ("DL","Delta Airlines"),
                     ("DY", "Norwegian") ]

        for e, a in zip(expected, airlines):
            self.assertEqual(e[0], a.code)
            self.assertEqual(e[1], a.name)
Exemplo n.º 2
0
def generate_airline_factory():
    airlines_xml = download_airline_xml()
    airlines = AirlineParser.parse_airlines(airlines_xml)
    airline_factory = AirlineFactory(airlines)
    return airline_factory
Exemplo n.º 3
0
    dest="arrivals_only",
    help="Print information about only arrivals.",
    default=False,
)


(options, args) = parser.parse_args()
airportname = args[0]


airports_xml = FlightInformationService.download_airport_xml()
airports = AirPortParser.parse_airports(airports_xml)
airport_factory = AirPortFactory(airports)

airlines_xml = FlightInformationService.download_airline_xml()
airlines = AirlineParser.parse_airlines(airlines_xml)
airline_factory = AirlineFactory(airlines)

status_xml = FlightInformationService.download_flight_status_xml()
statuses = FlightStatusParser.parse_statuses(status_xml)
status_factory = FlightStatusFactory(statuses)

airport = airport_factory.get_airport_by_code(airportname)
query = Query(airport)
xml = FlightInformationService.download_flight_xml(query)

flights = FlightParser.parse_flights(xml, airline_factory, airport_factory, status_factory)


print "Flight information for %s (%s)" % (airport.name, airport.code)
 def testRealisticData(self):
     xml_data = open("testdata/airlinenames.xml").read()
     
     airlines = AirlineParser.parse_airlines(xml_data)
     self.assertEqual(709, len(airlines))