Fix missing dummy values for debug

This commit is contained in:
Tim Bentley 2014-10-27 20:22:57 +00:00
parent 8720ed1b72
commit afde4a25ad
2 changed files with 30 additions and 3 deletions

View File

@ -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
"""

View File

@ -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