The raspi now controls a motor to lock unlock
This commit is contained in:
2026-06-07 10:27:22 +02:00
parent 02f7502daf
commit 79d441a86e
4 changed files with 214 additions and 10 deletions
+40
View File
@@ -0,0 +1,40 @@
import unittest
from raspi.motor import Raspi
class TestMotor(unittest.TestCase):
def setUp(self):
self.motor = Raspi()
def test_mock_unlock(self):
# Unlocking should not raise any errors, even if GPIO is not available
try:
self.motor.unlock()
success = True
except Exception:
success = False
self.assertTrue(success)
def test_mock_lock(self):
try:
self.motor.lock()
success = True
except Exception:
success = False
self.assertTrue(success)
def test_mock_async_unlock(self):
try:
self.motor.unlock_async()
success = True
except Exception:
success = False
self.assertTrue(success)
def test_mock_async_lock(self):
try:
self.motor.lock_async()
success = True
except Exception:
success = False
self.assertTrue(success)