From afde4a25ad26cff0c544f36be884c21dd5735399 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 27 Oct 2014 20:22:57 +0000 Subject: [PATCH] Fix missing dummy values for debug --- openlp/core/ui/slidecontroller.py | 6 ++--- .../openlp_plugins/remotes/test_router.py | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 062a8440f..1b8b45815 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -1245,7 +1245,7 @@ class SlideController(DisplayController, RegistryProperties): if event.timerId() == self.timer_id: self.on_slide_selected_next(self.play_slides_loop.isChecked()) - def on_edit_song(self): + def on_edit_song(self, field=None): """ From the preview display requires the service Item to be editied """ @@ -1254,7 +1254,7 @@ class SlideController(DisplayController, RegistryProperties): if new_item: self.add_service_item(new_item) - def on_preview_add_to_service(self): + def on_preview_add_to_service(self, field=None): """ From the preview display request the Item to be added to service """ @@ -1351,7 +1351,7 @@ class SlideController(DisplayController, RegistryProperties): seconds %= 60 self.audio_time_label.setText(' %02d:%02d ' % (minutes, seconds)) - def on_track_triggered(self): + def on_track_triggered(self, field=None): """ Start playing a track """ diff --git a/tests/functional/openlp_plugins/remotes/test_router.py b/tests/functional/openlp_plugins/remotes/test_router.py index 8d239a5f0..b1a157574 100644 --- a/tests/functional/openlp_plugins/remotes/test_router.py +++ b/tests/functional/openlp_plugins/remotes/test_router.py @@ -107,6 +107,33 @@ class TestRouter(TestCase, TestMixin): self.assertEqual(mocked_function, function['function'], 'The mocked function should match defined value.') self.assertFalse(function['secure'], 'The mocked function should not require any security.') + def process_secure_http_request_test(self): + """ + Test the router control functionality + """ + # GIVEN: A testing set of Routes + mocked_function = MagicMock() + test_route = [ + (r'^/stage/api/poll$', {'function': mocked_function, 'secure': True}), + ] + self.router.routes = test_route + self.router.settings_section = 'remotes' + Settings().setValue('remotes/authentication enabled', True) + self.router.path = '/stage/api/poll' + self.router.auth = '' + self.router.headers = {'Authorization': None} + self.router.send_response = MagicMock() + self.router.send_header = MagicMock() + self.router.end_headers = MagicMock() + self.router.wfile = MagicMock() + + # WHEN: called with a poll route + self.router.do_post_processor() + + # THEN: the function should have been called only once + self.router.send_response.assert_called_once_with(401) + self.assertEqual(self.router.send_header.call_count, 2, 'The header should have been called twice.') + def get_content_type_test(self): """ Test the get_content_type logic