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

Proposed by Tim Bentley
Status: Merged
Approved by: Raoul Snyman
Approved revision: 2728
Merged at revision: 2726
Proposed branch: lp:~trb143/openlp/removessl26
Merge into: lp:openlp
Diff against target: 293 lines (+22/-142)
4 files modified
openlp/plugins/remotes/lib/httpserver.py (+3/-24)
openlp/plugins/remotes/lib/remotetab.py (+1/-83)
tests/functional/openlp_plugins/remotes/test_remotetab.py (+18/-33)
tests/functional/openlp_plugins/remotes/test_router.py (+0/-2)
To merge this branch: bzr merge lp:~trb143/openlp/removessl26
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Review via email: mp+318988@code.launchpad.net

This proposal supersedes a proposal from 2017-03-04.

Commit message

With SSL being removed in 2.8 it and not supported in Android and iOS lets prevent it from living in 2.6.
Just removed the SSL code and stop the settings and not start the SSL server, full removal will be in 2.8 when we change server infrastructure,

Description of the change

Will SSL being removed in 2.8 it and not supported in Android and iOS lets prevent it from living in 2.6.
Just removed the SSL code to stop the settings and not start the SSL server full removal will be in 2.8 when we change server infrastructure,
With test this time.

lp:~trb143/openlp/removessl26 (revision 2728)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1921/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1832/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1773/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1504/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/1094/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/1162/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/1030/
[SUCCESS] https://ci.openlp.io/job/Branch-05c-Code_Analysis2/172/

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Could you add a new test please? It doesn't have to be related, can be anywhere else.

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/plugins/remotes/lib/httpserver.py'
2--- openlp/plugins/remotes/lib/httpserver.py 2016-12-31 11:01:36 +0000
3+++ openlp/plugins/remotes/lib/httpserver.py 2017-03-04 17:01:03 +0000
4@@ -111,14 +111,9 @@
5 self.address = address
6 self.is_secure = Settings().value(self.settings_section + '/https enabled')
7 self.needs_authentication = Settings().value(self.settings_section + '/authentication enabled')
8- if self.is_secure:
9- port = Settings().value(self.settings_section + '/https port')
10- self.port = port
11- self.start_server_instance(address, port, HTTPSServer)
12- else:
13- port = Settings().value(self.settings_section + '/port')
14- self.port = port
15- self.start_server_instance(address, port, ThreadingHTTPServer)
16+ port = Settings().value(self.settings_section + '/port')
17+ self.port = port
18+ self.start_server_instance(address, port, ThreadingHTTPServer)
19 if hasattr(self, 'httpd') and self.httpd:
20 self.httpd.serve_forever()
21 else:
22@@ -158,19 +153,3 @@
23 self.http_thread.stop()
24 self.httpd = None
25 log.debug('Stopped the server.')
26-
27-
28-class HTTPSServer(HTTPServer):
29- def __init__(self, address, handler):
30- """
31- Initialise the secure handlers for the SSL server if required.s
32- """
33- BaseServer.__init__(self, address, handler)
34- local_data = AppLocation.get_directory(AppLocation.DataDir)
35- self.socket = ssl.SSLSocket(
36- sock=socket.socket(self.address_family, self.socket_type),
37- certfile=os.path.join(local_data, 'remotes', 'openlp.crt'),
38- keyfile=os.path.join(local_data, 'remotes', 'openlp.key'),
39- server_side=True)
40- self.server_bind()
41- self.server_activate()
42
43=== modified file 'openlp/plugins/remotes/lib/remotetab.py'
44--- openlp/plugins/remotes/lib/remotetab.py 2016-12-31 11:01:36 +0000
45+++ openlp/plugins/remotes/lib/remotetab.py 2017-03-04 17:01:03 +0000
46@@ -88,42 +88,6 @@
47 self.live_url.setOpenExternalLinks(True)
48 self.http_setting_layout.addRow(self.live_url_label, self.live_url)
49 self.left_layout.addWidget(self.http_settings_group_box)
50- self.https_settings_group_box = QtWidgets.QGroupBox(self.left_column)
51- self.https_settings_group_box.setCheckable(True)
52- self.https_settings_group_box.setChecked(False)
53- self.https_settings_group_box.setObjectName('https_settings_group_box')
54- self.https_settings_layout = QtWidgets.QFormLayout(self.https_settings_group_box)
55- self.https_settings_layout.setObjectName('https_settings_layout')
56- self.https_error_label = QtWidgets.QLabel(self.https_settings_group_box)
57- self.https_error_label.setVisible(False)
58- self.https_error_label.setWordWrap(True)
59- self.https_error_label.setObjectName('https_error_label')
60- self.https_settings_layout.addRow(self.https_error_label)
61- self.https_port_label = QtWidgets.QLabel(self.https_settings_group_box)
62- self.https_port_label.setObjectName('https_port_label')
63- self.https_port_spin_box = QtWidgets.QSpinBox(self.https_settings_group_box)
64- self.https_port_spin_box.setMaximum(32767)
65- self.https_port_spin_box.setObjectName('https_port_spin_box')
66- self.https_settings_layout.addRow(self.https_port_label, self.https_port_spin_box)
67- self.remote_https_url = QtWidgets.QLabel(self.https_settings_group_box)
68- self.remote_https_url.setObjectName('remote_http_url')
69- self.remote_https_url.setOpenExternalLinks(True)
70- self.remote_https_url_label = QtWidgets.QLabel(self.https_settings_group_box)
71- self.remote_https_url_label.setObjectName('remote_http_url_label')
72- self.https_settings_layout.addRow(self.remote_https_url_label, self.remote_https_url)
73- self.stage_https_url_label = QtWidgets.QLabel(self.http_settings_group_box)
74- self.stage_https_url_label.setObjectName('stage_https_url_label')
75- self.stage_https_url = QtWidgets.QLabel(self.https_settings_group_box)
76- self.stage_https_url.setObjectName('stage_https_url')
77- self.stage_https_url.setOpenExternalLinks(True)
78- self.https_settings_layout.addRow(self.stage_https_url_label, self.stage_https_url)
79- self.live_https_url_label = QtWidgets.QLabel(self.https_settings_group_box)
80- self.live_https_url_label.setObjectName('live_url_label')
81- self.live_https_url = QtWidgets.QLabel(self.https_settings_group_box)
82- self.live_https_url.setObjectName('live_https_url')
83- self.live_https_url.setOpenExternalLinks(True)
84- self.https_settings_layout.addRow(self.live_https_url_label, self.live_https_url)
85- self.left_layout.addWidget(self.https_settings_group_box)
86 self.user_login_group_box = QtWidgets.QGroupBox(self.left_column)
87 self.user_login_group_box.setCheckable(True)
88 self.user_login_group_box.setChecked(False)
89@@ -177,8 +141,6 @@
90 self.thumbnails_check_box.stateChanged.connect(self.on_thumbnails_check_box_changed)
91 self.address_edit.textChanged.connect(self.set_urls)
92 self.port_spin_box.valueChanged.connect(self.set_urls)
93- self.https_port_spin_box.valueChanged.connect(self.set_urls)
94- self.https_settings_group_box.clicked.connect(self.https_changed)
95
96 def retranslateUi(self):
97 self.server_settings_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Server Settings'))
98@@ -200,14 +162,6 @@
99 translate('RemotePlugin.RemoteTab',
100 'Scan the QR code or click <a href="{qr}">download</a> to install the iOS app from the App '
101 'Store.').format(qr='https://itunes.apple.com/app/id1096218725'))
102- self.https_settings_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'HTTPS Server'))
103- self.https_error_label.setText(
104- translate('RemotePlugin.RemoteTab', 'Could not find an SSL certificate. The HTTPS server will not be '
105- 'available unless an SSL certificate is found. Please see the manual for more information.'))
106- self.https_port_label.setText(self.port_label.text())
107- self.remote_https_url_label.setText(self.remote_url_label.text())
108- self.stage_https_url_label.setText(self.stage_url_label.text())
109- self.live_https_url_label.setText(self.live_url_label.text())
110 self.user_login_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'User Authentication'))
111 self.user_id_label.setText(translate('RemotePlugin.RemoteTab', 'User id:'))
112 self.password_label.setText(translate('RemotePlugin.RemoteTab', 'Password:'))
113@@ -218,17 +172,11 @@
114 """
115 ip_address = self.get_ip_address(self.address_edit.text())
116 http_url = 'http://{url}:{text}/'.format(url=ip_address, text=self.port_spin_box.value())
117- https_url = 'https://{url}:{text}/'.format(url=ip_address, text=self.https_port_spin_box.value())
118 self.remote_url.setText('<a href="{url}">{url}</a>'.format(url=http_url))
119- self.remote_https_url.setText('<a href="{url}">{url}</a>'.format(url=https_url))
120 http_url_temp = http_url + 'stage'
121- https_url_temp = https_url + 'stage'
122 self.stage_url.setText('<a href="{url}">{url}</a>'.format(url=http_url_temp))
123- self.stage_https_url.setText('<a href="{url}">{url}</a>'.format(url=https_url_temp))
124 http_url_temp = http_url + 'main'
125- https_url_temp = https_url + 'main'
126 self.live_url.setText('<a href="{url}">{url}</a>'.format(url=http_url_temp))
127- self.live_https_url.setText('<a href="{url}">{url}</a>'.format(url=https_url_temp))
128
129 def get_ip_address(self, ip_address):
130 """
131@@ -254,43 +202,25 @@
132 """
133 Load the configuration and update the server configuration if necessary
134 """
135- self.is_secure = Settings().value(self.settings_section + '/https enabled')
136 self.port_spin_box.setValue(Settings().value(self.settings_section + '/port'))
137- self.https_port_spin_box.setValue(Settings().value(self.settings_section + '/https port'))
138 self.address_edit.setText(Settings().value(self.settings_section + '/ip address'))
139 self.twelve_hour = Settings().value(self.settings_section + '/twelve hour')
140 self.twelve_hour_check_box.setChecked(self.twelve_hour)
141 self.thumbnails = Settings().value(self.settings_section + '/thumbnails')
142 self.thumbnails_check_box.setChecked(self.thumbnails)
143- local_data = AppLocation.get_directory(AppLocation.DataDir)
144- if not os.path.exists(os.path.join(local_data, 'remotes', 'openlp.crt')) or \
145- not os.path.exists(os.path.join(local_data, 'remotes', 'openlp.key')):
146- self.https_settings_group_box.setChecked(False)
147- self.https_settings_group_box.setEnabled(False)
148- self.https_error_label.setVisible(True)
149- else:
150- self.https_settings_group_box.setChecked(Settings().value(self.settings_section + '/https enabled'))
151- self.https_settings_group_box.setEnabled(True)
152- self.https_error_label.setVisible(False)
153 self.user_login_group_box.setChecked(Settings().value(self.settings_section + '/authentication enabled'))
154 self.user_id.setText(Settings().value(self.settings_section + '/user id'))
155 self.password.setText(Settings().value(self.settings_section + '/password'))
156 self.set_urls()
157- self.https_changed()
158
159 def save(self):
160 """
161 Save the configuration and update the server configuration if necessary
162 """
163 if Settings().value(self.settings_section + '/ip address') != self.address_edit.text() or \
164- Settings().value(self.settings_section + '/port') != self.port_spin_box.value() or \
165- Settings().value(self.settings_section + '/https port') != self.https_port_spin_box.value() or \
166- Settings().value(self.settings_section + '/https enabled') != \
167- self.https_settings_group_box.isChecked():
168+ Settings().value(self.settings_section + '/port') != self.port_spin_box.value():
169 self.settings_form.register_post_process('remotes_config_updated')
170 Settings().setValue(self.settings_section + '/port', self.port_spin_box.value())
171- Settings().setValue(self.settings_section + '/https port', self.https_port_spin_box.value())
172- Settings().setValue(self.settings_section + '/https enabled', self.https_settings_group_box.isChecked())
173 Settings().setValue(self.settings_section + '/ip address', self.address_edit.text())
174 Settings().setValue(self.settings_section + '/twelve hour', self.twelve_hour)
175 Settings().setValue(self.settings_section + '/thumbnails', self.thumbnails)
176@@ -317,12 +247,6 @@
177 if check_state == QtCore.Qt.Checked:
178 self.thumbnails = True
179
180- def https_changed(self):
181- """
182- Invert the HTTP group box based on Https group settings
183- """
184- self.http_settings_group_box.setEnabled(not self.https_settings_group_box.isChecked())
185-
186 def generate_icon(self):
187 """
188 Generate icon for main window
189@@ -330,12 +254,6 @@
190 self.remote_server_icon.hide()
191 icon = QtGui.QImage(':/remote/network_server.png')
192 icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
193- if self.is_secure:
194- overlay = QtGui.QImage(':/remote/network_ssl.png')
195- overlay = overlay.scaled(60, 60, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
196- painter = QtGui.QPainter(icon)
197- painter.drawImage(0, 0, overlay)
198- painter.end()
199 if Settings().value(self.settings_section + '/authentication enabled'):
200 overlay = QtGui.QImage(':/remote/network_auth.png')
201 overlay = overlay.scaled(60, 60, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
202
203=== modified file 'tests/functional/openlp_plugins/remotes/test_remotetab.py'
204--- tests/functional/openlp_plugins/remotes/test_remotetab.py 2016-12-31 11:01:36 +0000
205+++ tests/functional/openlp_plugins/remotes/test_remotetab.py 2017-03-04 17:01:03 +0000
206@@ -37,8 +37,6 @@
207 __default_settings__ = {
208 'remotes/twelve hour': True,
209 'remotes/port': 4316,
210- 'remotes/https port': 4317,
211- 'remotes/https enabled': False,
212 'remotes/user id': 'openlp',
213 'remotes/password': 'password',
214 'remotes/authentication enabled': False,
215@@ -85,7 +83,6 @@
216 """
217 Test the get_ip_address function with given ip address
218 """
219- # GIVEN: A mocked location
220 # GIVEN: An ip address
221 given_ip = '192.168.1.1'
222 # WHEN: the default ip address is given
223@@ -114,36 +111,24 @@
224 self.form.set_urls()
225 # THEN: the following screen values should be set
226 self.assertEqual(self.form.address_edit.text(), ZERO_URL, 'The default URL should be set on the screen')
227- self.assertEqual(self.form.https_settings_group_box.isEnabled(), False,
228- 'The Https box should not be enabled')
229- self.assertEqual(self.form.https_settings_group_box.isChecked(), False,
230- 'The Https checked box should note be Checked')
231 self.assertEqual(self.form.user_login_group_box.isChecked(), False,
232 'The authentication box should not be enabled')
233
234- def test_set_certificate_urls(self):
235- """
236- Test the set_urls function with certificate available
237- """
238- # GIVEN: A mocked location
239- with patch('openlp.core.common.Settings') as mocked_class, \
240- patch('openlp.core.common.applocation.AppLocation.get_directory') as mocked_get_directory, \
241- patch('openlp.core.common.check_directory_exists') as mocked_check_directory_exists, \
242- patch('openlp.core.common.applocation.os') as mocked_os:
243- # GIVEN: A mocked out Settings class and a mocked out AppLocation.get_directory()
244- mocked_settings = mocked_class.return_value
245- mocked_settings.contains.return_value = False
246- mocked_get_directory.return_value = TEST_PATH
247- mocked_check_directory_exists.return_value = True
248- mocked_os.path.normpath.return_value = TEST_PATH
249-
250- # WHEN: when the set_urls is called having reloaded the form.
251- self.form.load()
252- self.form.set_urls()
253- # THEN: the following screen values should be set
254- self.assertEqual(self.form.http_settings_group_box.isEnabled(), True,
255- 'The Http group box should be enabled')
256- self.assertEqual(self.form.https_settings_group_box.isChecked(), False,
257- 'The Https checked box should be Checked')
258- self.assertEqual(self.form.https_settings_group_box.isEnabled(), True,
259- 'The Https box should be enabled')
260+ def test_set_urls(self):
261+ """
262+ Test the set_url function to generate correct url links
263+ """
264+ # GIVEN: An ip address
265+ self.form.address_edit.setText('192.168.1.1')
266+ # WHEN: the urls are generated
267+ self.form.set_urls()
268+ # THEN: the following links are returned
269+ self.assertEqual(self.form.remote_url.text(),
270+ "<a href=\"http://192.168.1.1:4316/\">http://192.168.1.1:4316/</a>",
271+ 'The return value should be a fully formed link')
272+ self.assertEqual(self.form.stage_url.text(),
273+ "<a href=\"http://192.168.1.1:4316/stage\">http://192.168.1.1:4316/stage</a>",
274+ 'The return value should be a fully formed stage link')
275+ self.assertEqual(self.form.live_url.text(),
276+ "<a href=\"http://192.168.1.1:4316/main\">http://192.168.1.1:4316/main</a>",
277+ 'The return value should be a fully formed main link')
278
279=== modified file 'tests/functional/openlp_plugins/remotes/test_router.py'
280--- tests/functional/openlp_plugins/remotes/test_router.py 2016-12-31 11:01:36 +0000
281+++ tests/functional/openlp_plugins/remotes/test_router.py 2017-03-04 17:01:03 +0000
282@@ -35,8 +35,6 @@
283 __default_settings__ = {
284 'remotes/twelve hour': True,
285 'remotes/port': 4316,
286- 'remotes/https port': 4317,
287- 'remotes/https enabled': False,
288 'remotes/user id': 'openlp',
289 'remotes/password': 'password',
290 'remotes/authentication enabled': False,
291
292=== removed file 'tests/resources/remotes/openlp.crt'
293=== removed file 'tests/resources/remotes/openlp.key'