forked from openlp/openlp
add tests
This commit is contained in:
parent
36276d4fac
commit
619d7ce839
@ -20,10 +20,10 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from openlp.core.common.registry import Registry
|
from openlp.core.common.registry import Registry
|
||||||
from openlp.core.api.endpoint.controller import controller_text
|
from openlp.core.api.endpoint.controller import controller_text, controller_direction
|
||||||
|
|
||||||
|
|
||||||
class TestController(TestCase):
|
class TestController(TestCase):
|
||||||
@ -52,3 +52,25 @@ class TestController(TestCase):
|
|||||||
results = ret['results']
|
results = ret['results']
|
||||||
assert isinstance(results['item'], MagicMock)
|
assert isinstance(results['item'], MagicMock)
|
||||||
assert len(results['slides']) == 0
|
assert len(results['slides']) == 0
|
||||||
|
|
||||||
|
def test_controller_direction_next(self):
|
||||||
|
"""
|
||||||
|
Text the live next method is triggered
|
||||||
|
"""
|
||||||
|
# GIVEN: A mocked service with a dummy service item
|
||||||
|
self.mocked_live_controller.service_item = MagicMock()
|
||||||
|
# WHEN: I trigger the method
|
||||||
|
controller_direction(None, "live", "next")
|
||||||
|
# THEN: The correct method is called
|
||||||
|
self.mocked_live_controller.slidecontroller_live_next.emit.assert_called_once()
|
||||||
|
|
||||||
|
def test_controller_direction_previous(self):
|
||||||
|
"""
|
||||||
|
Text the live next method is triggered
|
||||||
|
"""
|
||||||
|
# GIVEN: A mocked service with a dummy service item
|
||||||
|
self.mocked_live_controller.service_item = MagicMock()
|
||||||
|
# WHEN: I trigger the method
|
||||||
|
controller_direction(None, "live", "previous")
|
||||||
|
# THEN: The correct method is called
|
||||||
|
self.mocked_live_controller.slidecontroller_live_previous.emit.assert_called_once()
|
||||||
|
Loading…
Reference in New Issue
Block a user