Beispiel #1
0
 def test_should_stop_motor(self):
     motor = Motor(0, 0)
     motor.turn_left()
     motor.stop()
     self.assertEqual(False, motor.pin_a.value)
     self.assertEqual(False, motor.pin_b.value)
     self.assertFalse(motor.is_on())
Beispiel #2
0
    def test_should_turn_right_02_degrees(self):
        executor = RPiExecutor()
        motor = Motor(0, 0)
        control = Control(motor, executor, None)

        motor.turn_right = MagicMock()
        motor.stop = MagicMock()
        executor.move = MagicMock()

        control.turn_right(10)

        executor.move.assert_called_with(motor)
        motor.turn_right.assert_called_with()
        motor.stop.assert_called_with()