From d78ed92c4e2e7c5672494373b0067152b54377c6 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 23 May 2016 19:15:07 +0100 Subject: [PATCH 1/2] fixes --- openlp/core/lib/spelltextedit.py | 1 + openlp/core/ui/servicemanager.py | 4 ++-- openlp/plugins/remotes/lib/httpserver.py | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index 3b97323af..8b6b552be 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -142,6 +142,7 @@ class SpellTextEdit(QtWidgets.QPlainTextEdit): """ Replaces the selected text with word. """ + tag = tag.replace('&', '') for html in FormattingTags.get_html_tags(): if tag == html['desc']: cursor = self.textCursor() diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 6db806995..cb49f528a 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1322,8 +1322,8 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtWidgets.QWidget, Ui_ServiceMa The theme may have changed in the settings dialog so make sure the theme combo box is in the correct state. """ visible = 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): diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 26f00c359..88d1097dc 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -167,7 +167,6 @@ class HTTPSServer(HTTPServer): 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) From ff541f36ed9c00e45593b70cdbb0d46dd4c4b35a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 23 May 2016 19:26:03 +0100 Subject: [PATCH 2/2] with test --- .../openlp_plugins/remotes/test_router.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/functional/openlp_plugins/remotes/test_router.py b/tests/functional/openlp_plugins/remotes/test_router.py index 28af5f2c1..e91db457b 100644 --- a/tests/functional/openlp_plugins/remotes/test_router.py +++ b/tests/functional/openlp_plugins/remotes/test_router.py @@ -378,3 +378,26 @@ class TestRouter(TestCase, TestMixin): # THEN: we should use the specific stage file instance self.router._process_file.assert_called_with(os.path.join('trb', 'trb.css')) + + 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/plain') + self.assertEqual(self.router.end_headers.call_count, 1, 'end_headers called once')