Merge lp:~trb143/openlp/startup_thread_error into lp:openlp

Proposed by Tim Bentley
Status: Merged
Merged at revision: 2430
Proposed branch: lp:~trb143/openlp/startup_thread_error
Merge into: lp:openlp
Diff against target: 68 lines (+30/-3)
2 files modified
openlp/core/ui/slidecontroller.py (+3/-3)
tests/functional/openlp_plugins/remotes/test_router.py (+27/-0)
To merge this branch: bzr merge lp:~trb143/openlp/startup_thread_error
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Review via email: mp+239769@code.launchpad.net

Description of the change

More errors found and test for security

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote :
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/ui/slidecontroller.py'
2--- openlp/core/ui/slidecontroller.py 2014-10-21 21:06:02 +0000
3+++ openlp/core/ui/slidecontroller.py 2014-10-27 20:35:38 +0000
4@@ -1245,7 +1245,7 @@
5 if event.timerId() == self.timer_id:
6 self.on_slide_selected_next(self.play_slides_loop.isChecked())
7
8- def on_edit_song(self):
9+ def on_edit_song(self, field=None):
10 """
11 From the preview display requires the service Item to be editied
12 """
13@@ -1254,7 +1254,7 @@
14 if new_item:
15 self.add_service_item(new_item)
16
17- def on_preview_add_to_service(self):
18+ def on_preview_add_to_service(self, field=None):
19 """
20 From the preview display request the Item to be added to service
21 """
22@@ -1351,7 +1351,7 @@
23 seconds %= 60
24 self.audio_time_label.setText(' %02d:%02d ' % (minutes, seconds))
25
26- def on_track_triggered(self):
27+ def on_track_triggered(self, field=None):
28 """
29 Start playing a track
30 """
31
32=== modified file 'tests/functional/openlp_plugins/remotes/test_router.py'
33--- tests/functional/openlp_plugins/remotes/test_router.py 2014-10-22 20:47:47 +0000
34+++ tests/functional/openlp_plugins/remotes/test_router.py 2014-10-27 20:35:38 +0000
35@@ -107,6 +107,33 @@
36 self.assertEqual(mocked_function, function['function'], 'The mocked function should match defined value.')
37 self.assertFalse(function['secure'], 'The mocked function should not require any security.')
38
39+ def process_secure_http_request_test(self):
40+ """
41+ Test the router control functionality
42+ """
43+ # GIVEN: A testing set of Routes
44+ mocked_function = MagicMock()
45+ test_route = [
46+ (r'^/stage/api/poll$', {'function': mocked_function, 'secure': True}),
47+ ]
48+ self.router.routes = test_route
49+ self.router.settings_section = 'remotes'
50+ Settings().setValue('remotes/authentication enabled', True)
51+ self.router.path = '/stage/api/poll'
52+ self.router.auth = ''
53+ self.router.headers = {'Authorization': None}
54+ self.router.send_response = MagicMock()
55+ self.router.send_header = MagicMock()
56+ self.router.end_headers = MagicMock()
57+ self.router.wfile = MagicMock()
58+
59+ # WHEN: called with a poll route
60+ self.router.do_post_processor()
61+
62+ # THEN: the function should have been called only once
63+ self.router.send_response.assert_called_once_with(401)
64+ self.assertEqual(self.router.send_header.call_count, 2, 'The header should have been called twice.')
65+
66 def get_content_type_test(self):
67 """
68 Test the get_content_type logic