From 619d7ce83987994bb3fa9357d1839b9e8c2a94c1 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 23 Feb 2018 16:55:17 +0000 Subject: [PATCH] add tests --- .../api/endpoint/test_controller.py | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/functional/openlp_core/api/endpoint/test_controller.py b/tests/functional/openlp_core/api/endpoint/test_controller.py index f21600ffb..7e2b47c0e 100644 --- a/tests/functional/openlp_core/api/endpoint/test_controller.py +++ b/tests/functional/openlp_core/api/endpoint/test_controller.py @@ -20,10 +20,10 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### 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.api.endpoint.controller import controller_text +from openlp.core.api.endpoint.controller import controller_text, controller_direction class TestController(TestCase): @@ -52,3 +52,25 @@ class TestController(TestCase): results = ret['results'] assert isinstance(results['item'], MagicMock) 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()