Beispiel #1
0
 def test_process_qpx(self):
     #got to figure our how to load initial data
     departure_date = datetime.strptime(trip_dates.get('departure_date'), '%Y-%m-%d')
     dates = Dates.objects.get(departure_date=departure_date)
     self.assertEqual(Slice.objects.count(), 0)
     self.assertEqual(HistoricSlice.objects.count(), 0)
     process_qpx(flight_data, dates)
     self.assertEqual(Slice.objects.count(), 20)
     self.assertEqual(HistoricSlice.objects.count(), 0)
     process_qpx(flight_data, dates)
     self.assertEqual(Slice.objects.count(), 20)
     self.assertEqual(HistoricSlice.objects.count(), 20)
     self.assertEqual(Slice.objects.count(), HistoricSlice.objects.count())
Beispiel #2
0
 def test_process_qpx_no_data(self):
     departure_date = datetime.strptime(trip_dates.get('departure_date'), '%Y-%m-%d')
     dates = Dates.objects.get(departure_date=departure_date)
     process_qpx(no_data, dates)
     self.assertEqual(Slice.objects.count(), HistoricSlice.objects.count())
Beispiel #3
0
 def create(self):
     departure_date = datetime.strptime(self.data.get('dates').get('departure_date'), '%Y-%m-%d')
     return_date = datetime.strptime(self.data.get('dates').get('return_date'), '%Y-%m-%d')
     dates = Dates.objects.get(departure_date=departure_date, return_date=return_date)
     return process_qpx(self.data.get('qpx_data'), dates)