def test_single_unprecedented(self): pilot = helper.create_pilot() airstrip = helper.create_airstrip() aircraft = helper.create_aircrafttype() expected = {} self.assertEqual(util.get_precedented_checkouts(), expected)
def test_single_precedented(self): c = helper.create_checkout() expected = { c.airstrip.ident: { c.aircraft_type.name: True, }, } self.assertEqual(util.get_precedented_checkouts(), expected)
def test_multiple(self): pilot1 = helper.create_pilot('kim', 'Kim', 'Pilot1') pilot2 = helper.create_pilot('sam', 'Sam', 'Pilot2') actype1 = helper.create_aircrafttype('Name1') actype2 = helper.create_aircrafttype('Name2') airstrip1 = helper.create_airstrip('ID1', 'Airstrip1') airstrip2 = helper.create_airstrip('ID2', 'Airstrip2') airstrip3 = helper.create_airstrip('ID3', 'Airstrip3') c1 = helper.create_checkout(pilot=pilot1, airstrip=airstrip1, aircraft_type=actype1) c2 = helper.create_checkout(pilot=pilot1, airstrip=airstrip1, aircraft_type=actype2) c3 = helper.create_checkout(pilot=pilot2, airstrip=airstrip2, aircraft_type=actype1) expected = { airstrip1.ident: { actype1.name: True, actype2.name: True, }, airstrip2.ident: { actype1.name: True, }, } self.assertEqual(util.get_precedented_checkouts(), expected)
def test_empty(self): self.assertEqual(util.get_precedented_checkouts(), {})