Beispiel #1
0
 def test_can_operate(self):
     opts = TakeoffPilot.get_operational_combinations()
     combinations = [
         # Only Pilot Flying
         ('Pilot Flying', 'Takeoff'),
         # Only Controls:
         ('Pitch (Capt)', 'Pitch (FO)', 'Roll (Capt)', 'Roll (FO)', 'Takeoff'),
         # Only Control Column Forces:
         ('Control Column Force (Capt)', 'Control Column Force (FO)', 'Takeoff'),
         # Only Autopilot:
         ('AP (1) Engaged', 'AP (2) Engaged', 'Liftoff'),
         # Everything:
         ('Pilot Flying',
          'Pitch (Capt)', 'Pitch (FO)', 'Roll (Capt)', 'Roll (FO)',
          'Control Column Force (Capt)', 'Control Column Force (FO)',
          'AP (1) Engaged', 'AP (2) Engaged', 'Takeoff', 'Liftoff'),
     ]
     for combination in combinations:
         self.assertIn(combination, opts, msg=combination)
Beispiel #2
0
    def test_derive(self, value_at_index):
        ap1 = Mock()
        ap2 = Mock()
        ap3 = Mock()
        phase = Mock()

        pitch_capt = Mock()
        pitch_fo = Mock()
        roll_capt = Mock()
        roll_fo = Mock()

        ap1_eng = Mock()
        ap2_eng = Mock()
        ap3_eng = Mock()
        value_at_index.side_effect = [ap1, ap2, ap3]

        takeoffs = Mock()
        takeoffs.get_first = Mock()
        takeoffs.get_first.return_value = phase

        liftoffs = Mock()
        liftoffs.get_first = Mock()
        liftoffs.get_first.return_value = Mock()

        pilot = TakeoffPilot()
        pilot._determine_pilot = Mock()
        pilot._determine_pilot.return_value = Mock()
        pilot.set_flight_attr = Mock()

        pilot.derive(pitch_capt, pitch_fo, roll_capt, roll_fo, ap1_eng,
                ap2_eng, ap3_eng, None, None, takeoffs, liftoffs)

        #self.assertTrue(takeoffs.get_first.called)
        #self.assertTrue(liftoffs.get_first.called)

        #pilot._determine_pilot.assert_called_once_with(pitch_capt, pitch_fo,
        #        roll_capt, roll_fo, phase, ap1, ap2, ap3, None, None)

        pilot.set_flight_attr.assert_called_once_with(pilot._determine_pilot.return_value)