← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/may_fixes into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/may_fixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~trb143/openlp/may_fixes/+merge/295110

Fix ssl version to allow Android to use ssl.  SSL is now auto negotiated.
Fix SeriveManager service theme hiding.  Bug since 1.9 series.
Fix missing check dependancies for six
Fix PEP8 errors.

lp:~trb143/openlp/may_fixes (revision 2666)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1562/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1473/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1411/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1191/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/781/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/849/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/717/ 
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/may_fixes into lp:openlp.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2016-05-17 21:19:20 +0000
+++ openlp/core/ui/servicemanager.py	2016-05-18 17:29:16 +0000
@@ -1324,8 +1324,8 @@
         The theme may have changed in the settings dialog so make sure the theme combo box is in the correct state.
         """
         visible = not self.renderer.theme_level == ThemeLevel.Global
-        self.theme_label.setVisible(visible)
-        self.theme_combo_box.setVisible(visible)
+        self.toolbar.actions['theme_combo_box'].setVisible(visible)
+        self.toolbar.actions['theme_label'].setVisible(visible)
         self.regenerate_service_items()
 
     def regenerate_service_items(self, changed=False):

=== modified file 'openlp/plugins/remotes/lib/httprouter.py'
--- openlp/plugins/remotes/lib/httprouter.py	2016-03-19 19:42:10 +0000
+++ openlp/plugins/remotes/lib/httprouter.py	2016-05-18 17:29:16 +0000
@@ -221,9 +221,13 @@
         self.request_data = None
         url_path_split = urlparse(url_path)
         url_query = parse_qs(url_path_split.query)
-        # GET
-        if 'data' in url_query.keys():
-            self.request_data = url_query['data'][0]
+        # Get data from HTTP request
+        if self.command == 'GET':
+            if 'data' in url_query.keys():
+                self.request_data = url_query['data'][0]
+        elif self.command == 'POST':
+            content_len = int(self.headers['content-length'])
+            self.request_data = self.rfile.read(content_len).decode("utf-8")
         for route, func in self.routes:
             match = re.match(route, url_path_split.path)
             if match:
@@ -401,10 +405,8 @@
         log.debug('serve file request %s' % file_name)
         if not file_name:
             file_name = 'index.html'
-        elif file_name == 'stage':
-            file_name = 'stage.html'
-        elif file_name == 'main':
-            file_name = 'main.html'
+        if '.' not in file_name:
+            file_name += '.html'
         if file_name.startswith('/'):
             file_name = file_name[1:]
         path = os.path.normpath(os.path.join(self.html_dir, file_name))

=== modified file 'openlp/plugins/remotes/lib/httpserver.py'
--- openlp/plugins/remotes/lib/httpserver.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/remotes/lib/httpserver.py	2016-05-18 17:29:16 +0000
@@ -167,7 +167,6 @@
         local_data = AppLocation.get_directory(AppLocation.DataDir)
         self.socket = ssl.SSLSocket(
             sock=socket.socket(self.address_family, self.socket_type),
-            ssl_version=ssl.PROTOCOL_TLSv1_2,
             certfile=os.path.join(local_data, 'remotes', 'openlp.crt'),
             keyfile=os.path.join(local_data, 'remotes', 'openlp.key'),
             server_side=True)

=== modified file 'scripts/check_dependencies.py'
--- scripts/check_dependencies.py	2016-01-02 23:13:48 +0000
+++ scripts/check_dependencies.py	2016-05-18 17:29:16 +0000
@@ -93,6 +93,7 @@
     'bs4',
     'mako',
     'uno',
+    'six'
 ]
 
 

=== modified file 'tests/functional/openlp_core_common/test_actions.py'
--- tests/functional/openlp_core_common/test_actions.py	2016-05-17 19:35:25 +0000
+++ tests/functional/openlp_core_common/test_actions.py	2016-05-18 17:29:16 +0000
@@ -118,7 +118,7 @@
         # GIVEN: The list including two actions
         self.list.add(self.action1)
         self.list.add(self.action2)
-        
+
         # WHEN: Iterating over the list
         l = [a for a in self.list]
         # THEN: Make sure they are returned in correct order

=== modified file 'tests/functional/openlp_core_lib/test_lib.py'
--- tests/functional/openlp_core_lib/test_lib.py	2016-05-16 12:35:58 +0000
+++ tests/functional/openlp_core_lib/test_lib.py	2016-05-18 17:29:16 +0000
@@ -431,7 +431,6 @@
         thumb_size = QtCore.QSize(-1, 100)
         expected_size_1 = QtCore.QSize(88, 88)
         expected_size_2 = QtCore.QSize(100, 100)
-        
 
         # Remove the thumb so that the test actually tests if the thumb will be created. Maybe it was not deleted in the
         # last test.
@@ -458,7 +457,7 @@
         with patch('openlp.core.lib.QtGui.QImageReader.size') as mocked_size:
             mocked_size.return_value = QtCore.QSize(0, 0)
             icon = create_thumb(image_path, thumb_path, size=thumb_size)
-        
+
         # THEN: Check if the thumb was created with aspect ratio of 1.
         self.assertIsInstance(icon, QtGui.QIcon, 'The icon should be a QIcon')
         self.assertFalse(icon.isNull(), 'The icon should not be null')

=== modified file 'tests/functional/openlp_plugins/remotes/test_router.py'
--- tests/functional/openlp_plugins/remotes/test_router.py	2016-01-11 21:57:45 +0000
+++ tests/functional/openlp_plugins/remotes/test_router.py	2016-05-18 17:29:16 +0000
@@ -94,6 +94,7 @@
             (r'^/stage/api/poll$', {'function': mocked_function, 'secure': False}),
         ]
         self.router.routes = test_route
+        self.router.command = 'GET'
 
         # WHEN: called with a poll route
         function, args = self.router.process_http_request('/stage/api/poll', None)
@@ -121,6 +122,7 @@
         self.router.send_header = MagicMock()
         self.router.end_headers = MagicMock()
         self.router.wfile = MagicMock()
+        self.router.command = 'GET'
 
         # WHEN: called with a poll route
         self.router.do_post_processor()
@@ -211,6 +213,29 @@
             self.router.send_header.assert_called_once_with('Content-type', 'text/html')
             self.assertEqual(self.router.end_headers.call_count, 1, 'end_headers called once')
 
+    def serve_file_with_partial_params_test(self):
+        """
+        Test the serve_file method with an existing file
+        """
+        # GIVEN: mocked environment
+        self.router.send_response = MagicMock()
+        self.router.send_header = MagicMock()
+        self.router.end_headers = MagicMock()
+        self.router.wfile = MagicMock()
+        self.router.html_dir = os.path.normpath('test/dir')
+        self.router.template_vars = MagicMock()
+        with patch('openlp.core.lib.os.path.exists') as mocked_exists, \
+                patch('builtins.open', mock_open(read_data='123')):
+            mocked_exists.return_value = True
+
+            # WHEN: call serve_file with an existing html file
+            self.router.serve_file(os.path.normpath('test/dir/test'))
+
+            # THEN: it should return a 200 and the file
+            self.router.send_response.assert_called_once_with(200)
+            self.router.send_header.assert_called_once_with('Content-type', 'text/html')
+            self.assertEqual(self.router.end_headers.call_count, 1, 'end_headers called once')
+
     def serve_thumbnail_without_params_test(self):
         """
         Test the serve_thumbnail routine without params


Follow ups