Motor
The raspi now controls a motor to lock unlock
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user