mirror of
https://github.com/markqvist/Sideband.git
synced 2025-11-30 04:06:39 -05:00
Use local version of able
This commit is contained in:
parent
2e44d49d6b
commit
9b6a51a03e
67 changed files with 5305 additions and 0 deletions
34
libs/able/tests/test_ble_queue.py
Normal file
34
libs/able/tests/test_ble_queue.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import unittest
|
||||
import mock
|
||||
from able.queue import ble_task
|
||||
|
||||
|
||||
class TestBLETask(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.queue = mock.Mock()
|
||||
self.task_called = None
|
||||
|
||||
@ble_task
|
||||
def increment(self, a=1, b=0):
|
||||
self.task_called = a + b
|
||||
|
||||
def test_method_not_executed(self):
|
||||
self.increment()
|
||||
self.assertEqual(self.task_called, None)
|
||||
|
||||
def test_task_enqued(self):
|
||||
self.increment()
|
||||
self.assertTrue(self.queue.enque.called)
|
||||
|
||||
def test_task_default_arguments(self):
|
||||
self.increment()
|
||||
task = self.queue.enque.call_args[0][0]
|
||||
task()
|
||||
self.assertEqual(self.task_called, 1)
|
||||
|
||||
def test_task_arguments_passed(self):
|
||||
self.increment(200, 11)
|
||||
task = self.queue.enque.call_args[0][0]
|
||||
task()
|
||||
self.assertEqual(self.task_called, 211)
|
||||
Loading…
Add table
Add a link
Reference in a new issue