Example #1
0
 def test_api_qpx_post(self):
     payload ={
         'dates': {'departure_date': trip_dates.get('departure_date'), 'return_date': trip_dates.get('return_date')},
         'qpx_data':flight_data
     }
     r = self.client.post('/api/qpx/',
                          content_type='application/json',
                          data=json.dumps(payload))
     self.assertEqual(r.status_code, 201)
     self.assertEqual(Slice.objects.count(), 20)
     self.assertEqual(HistoricSlice.objects.count(), 0)
Example #2
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())
Example #3
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())