예제 #1
0
    def get_context_data(self, **kwargs):
        context = super(AirstripDetail, self).get_context_data(**kwargs)

        context['checkouts'] = util.airstrip_checkouts_grouped_by_pilot(
            self.object)

        return context
예제 #2
0
 def test_multiple_pilots(self):
     airstrip1 = helper.create_airstrip('ID1', 'Airstrip1')
     airstrip2 = helper.create_airstrip('ID2', 'Airstrip2')
     
     c1 = helper.create_checkout(airstrip=airstrip1)
     c2 = helper.create_checkout(airstrip=airstrip2, pilot=c1.pilot, aircraft_type=c1.aircraft_type)
     
     results = [{
         'pilot_name': c1.pilot.full_name,
         'pilot_slug': c1.pilot.username,
         'airstrip_ident': airstrip1.ident,
         'airstrip_name': airstrip1.name,
         'actypes': {
             c1.aircraft_type.name: util.CHECKOUT_SUDAH,
         },
     },]
     
     self.expected['aircraft_types'] = [c1.aircraft_type.name,]
     self.expected['results'] = results
     
     self.assertEqual(util.airstrip_checkouts_grouped_by_pilot(airstrip1), self.expected)
예제 #3
0
 def test_multiple_pilots(self):
     airstrip1 = helper.create_airstrip('ID1', 'Airstrip1')
     airstrip2 = helper.create_airstrip('ID2', 'Airstrip2')
     
     c1 = helper.create_checkout(airstrip=airstrip1)
     c2 = helper.create_checkout(airstrip=airstrip2, pilot=c1.pilot, aircraft_type=c1.aircraft_type)
     
     results = [{
         'pilot_name': c1.pilot.full_name,
         'pilot_slug': c1.pilot.username,
         'airstrip_ident': airstrip1.ident,
         'airstrip_name': airstrip1.name,
         'actypes': {
             c1.aircraft_type.name: util.CHECKOUT_SUDAH,
         },
     },]
     
     self.expected['aircraft_types'] = [c1.aircraft_type.name,]
     self.expected['results'] = results
     
     self.assertEqual(util.airstrip_checkouts_grouped_by_pilot(airstrip1), self.expected)
예제 #4
0
 def test_empty(self):
     airstrip = helper.create_airstrip()
     self.assertEqual(util.airstrip_checkouts_grouped_by_pilot(airstrip), self.expected)
예제 #5
0
 def test_empty(self):
     airstrip = helper.create_airstrip()
     self.assertEqual(util.airstrip_checkouts_grouped_by_pilot(airstrip), self.expected)