Merge lp:~alisonken1/openlp/pjlink2-s into lp:openlp
- pjlink2-s
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 2821 |
Proposed branch: | lp:~alisonken1/openlp/pjlink2-s |
Merge into: | lp:openlp |
Diff against target: |
457 lines (+140/-58) 9 files modified
openlp/core/common/actions.py (+1/-1) openlp/core/projectors/manager.py (+34/-37) openlp/core/projectors/pjlink.py (+74/-9) openlp/core/version.py (+2/-1) scripts/lp-merge.py (+2/-2) setup.cfg (+5/-0) tests/functional/openlp_core/common/test_actions.py (+17/-3) tests/functional/openlp_core/test_version.py (+3/-3) tests/openlp_core/projectors/test_projector_pjlink_base_01.py (+2/-2) |
To merge this branch: | bzr merge lp:~alisonken1/openlp/pjlink2-s |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tomas Groth | Approve | ||
Tim Bentley | Approve | ||
Review via email: mp+348709@code.launchpad.net |
This proposal supersedes a proposal from 2018-06-28.
Commit message
PJLink2 update S
Description of the change
- Convert action.remove raise ValueError on missing action to log.warning
- Added 2-second status timer to update icons during projector state change
- Update set power methods to use status timer
- Update set shutter methods to use status timer
- Fix process_avmt to include missing valid status from projector
- Update projector info menu to include version 2 information
- Add E_SOCKET_TIMEOUT to STATUS_ICONS dictionary
- Change 'Action "{action}" does not exist' from raise ValueError to log.warning
- Update projector to include PJLink2 extras
- Fix version check exception if server returns status code != 200
- Fix version tests for status code
- Fix actions tests for remove action not in list
- Fix projector tests for changed calls
- Update setup.cfg to inlude pycodestyle (pep8 deprecaded)
- PEP8 fix for scripts/
- Updated fix for version check exception
-------
lp:~alisonken1/openlp/pjlink2-s (revision 2822)
https:/
https:/
https:/
https:/
https:/
https:/
https:/
https:/
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal | # |
Tim Bentley (trb143) : Posted in a previous version of this proposal | # |
Tim Bentley (trb143) : | # |
Tomas Groth (tomasgroth) wrote : | # |
Looks good to me
Preview Diff
1 | === modified file 'openlp/core/common/actions.py' |
2 | --- openlp/core/common/actions.py 2017-12-29 09:15:48 +0000 |
3 | +++ openlp/core/common/actions.py 2018-06-28 17:08:08 +0000 |
4 | @@ -113,7 +113,7 @@ |
5 | if item[1] == action: |
6 | self.actions.remove(item) |
7 | return |
8 | - raise ValueError('Action "{action}" does not exist.'.format(action=action)) |
9 | + log.warning('Action "{action}" does not exist.'.format(action=action)) |
10 | |
11 | |
12 | class CategoryList(object): |
13 | |
14 | === modified file 'openlp/core/projectors/manager.py' |
15 | --- openlp/core/projectors/manager.py 2018-05-19 00:48:33 +0000 |
16 | +++ openlp/core/projectors/manager.py 2018-06-28 17:08:08 +0000 |
17 | @@ -36,8 +36,8 @@ |
18 | from openlp.core.lib.ui import create_widget_action |
19 | from openlp.core.projectors import DialogSourceStyle |
20 | from openlp.core.projectors.constants import E_AUTHENTICATION, E_ERROR, E_NETWORK, E_NOT_CONNECTED, \ |
21 | - E_UNKNOWN_SOCKET_ERROR, S_CONNECTED, S_CONNECTING, S_COOLDOWN, S_INITIALIZE, S_NOT_CONNECTED, S_OFF, S_ON, \ |
22 | - S_STANDBY, S_WARMUP, PJLINK_PORT, STATUS_CODE, STATUS_MSG, QSOCKET_STATE |
23 | + E_SOCKET_TIMEOUT, E_UNKNOWN_SOCKET_ERROR, S_CONNECTED, S_CONNECTING, S_COOLDOWN, S_INITIALIZE, \ |
24 | + S_NOT_CONNECTED, S_OFF, S_ON, S_STANDBY, S_WARMUP, PJLINK_PORT, STATUS_CODE, STATUS_MSG, QSOCKET_STATE |
25 | |
26 | from openlp.core.projectors.db import ProjectorDB |
27 | from openlp.core.projectors.editform import ProjectorEditForm |
28 | @@ -62,6 +62,7 @@ |
29 | S_COOLDOWN: ':/projector/projector_cooldown.png', |
30 | E_ERROR: ':/projector/projector_error.png', |
31 | E_NETWORK: ':/projector/projector_not_connected_error.png', |
32 | + E_SOCKET_TIMEOUT: ':/projector/projector_not_connected_error.png', |
33 | E_AUTHENTICATION: ':/projector/projector_not_connected_error.png', |
34 | E_UNKNOWN_SOCKET_ERROR: ':/projector/projector_not_connected_error.png', |
35 | E_NOT_CONNECTED: ':/projector/projector_not_connected_error.png' |
36 | @@ -360,22 +361,14 @@ |
37 | self.connect_action.setVisible(not visible) |
38 | self.disconnect_action.setVisible(visible) |
39 | self.status_action.setVisible(visible) |
40 | - if visible: |
41 | - self.select_input_action.setVisible(real_projector.link.power == S_ON) |
42 | - self.edit_input_action.setVisible(real_projector.link.power == S_ON) |
43 | - self.poweron_action.setVisible(real_projector.link.power == S_STANDBY) |
44 | - self.poweroff_action.setVisible(real_projector.link.power == S_ON) |
45 | - self.blank_action.setVisible(real_projector.link.power == S_ON and |
46 | - not real_projector.link.shutter) |
47 | - self.show_action.setVisible(real_projector.link.power == S_ON and |
48 | - real_projector.link.shutter) |
49 | - else: |
50 | - self.select_input_action.setVisible(False) |
51 | - self.edit_input_action.setVisible(False) |
52 | - self.poweron_action.setVisible(False) |
53 | - self.poweroff_action.setVisible(False) |
54 | - self.blank_action.setVisible(False) |
55 | - self.show_action.setVisible(False) |
56 | + self.select_input_action.setVisible(visible and real_projector.link.power == S_ON) |
57 | + self.edit_input_action.setVisible(visible and real_projector.link.power == S_ON) |
58 | + self.poweron_action.setVisible(visible and real_projector.link.power == S_STANDBY) |
59 | + self.poweroff_action.setVisible(visible and real_projector.link.power == S_ON) |
60 | + self.blank_action.setVisible(visible and real_projector.link.power == S_ON and |
61 | + not real_projector.link.shutter) |
62 | + self.show_action.setVisible(visible and real_projector.link.power == S_ON and |
63 | + real_projector.link.shutter) |
64 | self.menu.projector = real_projector |
65 | self.menu.exec(self.projector_list_widget.mapToGlobal(point)) |
66 | |
67 | @@ -516,11 +509,10 @@ |
68 | except (AttributeError, TypeError): |
69 | pass |
70 | # Disconnect signals from projector being deleted |
71 | - if self.pjlink_udp[projector.port]: |
72 | - try: |
73 | - self.pjlink_udp[projector.port].data_received.disconnect(projector.get_buffer) |
74 | - except (AttributeError, TypeError): |
75 | - pass |
76 | + try: |
77 | + self.pjlink_udp[projector.link.port].data_received.disconnect(projector.link.get_buffer) |
78 | + except (AttributeError, TypeError): |
79 | + pass |
80 | |
81 | # Rebuild projector list |
82 | new_list = [] |
83 | @@ -650,6 +642,21 @@ |
84 | data=projector.link.manufacturer) |
85 | message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', 'Model'), |
86 | data=projector.link.model) |
87 | + message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', 'PJLink Class'), |
88 | + data=projector.link.pjlink_class) |
89 | + if projector.link.pjlink_class != 1: |
90 | + message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', |
91 | + 'Software Version'), |
92 | + data=projector.link.sw_version) |
93 | + message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', |
94 | + 'Serial Number'), |
95 | + data=projector.link.serial_no) |
96 | + message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', |
97 | + 'Lamp Model Number'), |
98 | + data=projector.link.model_lamp) |
99 | + message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', |
100 | + 'Filter Model Number'), |
101 | + data=projector.link.model_filter) |
102 | message += '<b>{title}</b>: {data}<br /><br />'.format(title=translate('OpenLP.ProjectorManager', |
103 | 'Other info'), |
104 | data=projector.link.other_info) |
105 | @@ -663,20 +670,6 @@ |
106 | source=translate('OpenLP.ProjectorManager', |
107 | 'Current source input is'), |
108 | selected=projector.link.source) |
109 | - if projector.link.pjlink_class == '2': |
110 | - # Information only available for PJLink Class 2 projectors |
111 | - message += '<b>{title}</b>: {data}<br /><br />'.format(title=translate('OpenLP.ProjectorManager', |
112 | - 'Serial Number'), |
113 | - data=projector.serial_no) |
114 | - message += '<b>{title}</b>: {data}<br /><br />'.format(title=translate('OpenLP.ProjectorManager', |
115 | - 'Software Version'), |
116 | - data=projector.sw_version) |
117 | - message += '<b>{title}</b>: {data}<br /><br />'.format(title=translate('OpenLP.ProjectorManager', |
118 | - 'Lamp type'), |
119 | - data=projector.model_lamp) |
120 | - message += '<b>{title}</b>: {data}<br /><br />'.format(title=translate('OpenLP.ProjectorManager', |
121 | - 'Filter type'), |
122 | - data=projector.model_filter) |
123 | count = 1 |
124 | for item in projector.link.lamp: |
125 | if item['On'] is None: |
126 | @@ -957,6 +950,10 @@ |
127 | self.poll_time = None |
128 | self.socket_timeout = None |
129 | self.status = S_NOT_CONNECTED |
130 | + self.serial_no = None |
131 | + self.sw_version = None |
132 | + self.model_filter = None |
133 | + self.model_lamp = None |
134 | super().__init__() |
135 | |
136 | |
137 | |
138 | === modified file 'openlp/core/projectors/pjlink.py' |
139 | --- openlp/core/projectors/pjlink.py 2018-05-19 00:48:33 +0000 |
140 | +++ openlp/core/projectors/pjlink.py 2018-06-28 17:08:08 +0000 |
141 | @@ -59,7 +59,7 @@ |
142 | PJLINK_ERST_DATA, PJLINK_ERST_STATUS, PJLINK_MAX_PACKET, PJLINK_PREFIX, PJLINK_PORT, PJLINK_POWR_STATUS, \ |
143 | PJLINK_SUFFIX, PJLINK_VALID_CMD, PROJECTOR_STATE, STATUS_CODE, STATUS_MSG, QSOCKET_STATE, \ |
144 | E_AUTHENTICATION, E_CONNECTION_REFUSED, E_GENERAL, E_NETWORK, E_NOT_CONNECTED, E_SOCKET_TIMEOUT, \ |
145 | - S_CONNECTED, S_CONNECTING, S_NOT_CONNECTED, S_OFF, S_OK, S_ON |
146 | + S_CONNECTED, S_CONNECTING, S_NOT_CONNECTED, S_OFF, S_OK, S_ON, S_STANDBY |
147 | |
148 | log = logging.getLogger(__name__) |
149 | log.debug('pjlink loaded') |
150 | @@ -233,6 +233,10 @@ |
151 | if hasattr(self, 'socket_timer'): |
152 | log.debug('({ip}): Calling socket_timer.stop()'.format(ip=self.entry.name)) |
153 | self.socket_timer.stop() |
154 | + if hasattr(self, 'status_timer'): |
155 | + log.debug('({ip}): Calling status_timer.stop()'.format(ip=self.entry.name)) |
156 | + self.status_timer.stop() |
157 | + self.status_timer_checks = {} |
158 | self.send_busy = False |
159 | self.send_queue = [] |
160 | self.priority_queue = [] |
161 | @@ -287,14 +291,18 @@ |
162 | """ |
163 | Process shutter and speaker status. See PJLink specification for format. |
164 | Update self.mute (audio) and self.shutter (video shutter). |
165 | + 10 = Shutter open, audio unchanged |
166 | 11 = Shutter closed, audio unchanged |
167 | + 20 = Shutter unchanged, Audio normal |
168 | 21 = Shutter unchanged, Audio muted |
169 | - 30 = Shutter closed, audio muted |
170 | - 31 = Shutter open, audio normal |
171 | + 30 = Shutter open, audio muted |
172 | + 31 = Shutter closed, audio normal |
173 | |
174 | :param data: Shutter and audio status |
175 | """ |
176 | - settings = {'11': {'shutter': True, 'mute': self.mute}, |
177 | + settings = {'10': {'shutter': False, 'mute': self.mute}, |
178 | + '11': {'shutter': True, 'mute': self.mute}, |
179 | + '20': {'shutter': self.shutter, 'mute': False}, |
180 | '21': {'shutter': self.shutter, 'mute': True}, |
181 | '30': {'shutter': False, 'mute': False}, |
182 | '31': {'shutter': True, 'mute': True} |
183 | @@ -309,6 +317,8 @@ |
184 | self.shutter = shutter |
185 | self.mute = mute |
186 | if update_icons: |
187 | + if 'AVMT' in self.status_timer_checks: |
188 | + self.status_timer_delete('AVMT') |
189 | self.projectorUpdateIcons.emit() |
190 | return |
191 | |
192 | @@ -592,6 +602,8 @@ |
193 | else: |
194 | # Log unknown status response |
195 | log.warning('({ip}) Unknown power response: "{data}"'.format(ip=self.entry.name, data=data)) |
196 | + if self.power in [S_ON, S_STANDBY, S_OFF] and 'POWR' in self.status_timer_checks: |
197 | + self.status_timer_delete(cmd='POWR') |
198 | return |
199 | |
200 | def process_rfil(self, data): |
201 | @@ -734,6 +746,11 @@ |
202 | self.socket_timer = QtCore.QTimer(self) |
203 | self.socket_timer.setInterval(self.socket_timeout) |
204 | self.socket_timer.timeout.connect(self.socket_abort) |
205 | + # Timer for doing status updates for commands that change state and should update faster |
206 | + self.status_timer_checks = {} # Keep track of events for the status timer |
207 | + self.status_timer = QtCore.QTimer(self) |
208 | + self.status_timer.setInterval(2000) # 2 second interval should be fast enough |
209 | + self.status_timer.timeout.connect(self.status_timer_update) |
210 | # Socket status signals |
211 | self.connected.connect(self.check_login) |
212 | self.disconnected.connect(self.disconnect_from_host) |
213 | @@ -1191,12 +1208,12 @@ |
214 | self.change_status(S_NOT_CONNECTED) |
215 | self.reset_information() |
216 | |
217 | - def get_av_mute_status(self): |
218 | + def get_av_mute_status(self, priority=False): |
219 | """ |
220 | Send command to retrieve shutter status. |
221 | """ |
222 | log.debug('({ip}) Sending AVMT command'.format(ip=self.entry.name)) |
223 | - return self.send_command(cmd='AVMT') |
224 | + return self.send_command(cmd='AVMT', priority=priority) |
225 | |
226 | def get_available_inputs(self): |
227 | """ |
228 | @@ -1254,12 +1271,14 @@ |
229 | log.debug('({ip}) Sending INFO command'.format(ip=self.entry.name)) |
230 | return self.send_command(cmd='INFO') |
231 | |
232 | - def get_power_status(self): |
233 | + def get_power_status(self, priority=False): |
234 | """ |
235 | Send command to retrieve power status. |
236 | + |
237 | + :param priority: (OPTIONAL) Send in priority queue |
238 | """ |
239 | log.debug('({ip}) Sending POWR command'.format(ip=self.entry.name)) |
240 | - return self.send_command(cmd='POWR') |
241 | + return self.send_command(cmd='POWR', priority=priority) |
242 | |
243 | def set_input_source(self, src=None): |
244 | """ |
245 | @@ -1283,6 +1302,7 @@ |
246 | """ |
247 | log.debug('({ip}) Setting POWR to 1 (on)'.format(ip=self.entry.name)) |
248 | self.send_command(cmd='POWR', opts='1', priority=True) |
249 | + self.status_timer_add(cmd='POWR', callback=self.get_power_status) |
250 | self.poll_loop() |
251 | |
252 | def set_power_off(self): |
253 | @@ -1291,6 +1311,7 @@ |
254 | """ |
255 | log.debug('({ip}) Setting POWR to 0 (standby)'.format(ip=self.entry.name)) |
256 | self.send_command(cmd='POWR', opts='0', priority=True) |
257 | + self.status_timer_add(cmd='POWR', callback=self.get_power_status) |
258 | self.poll_loop() |
259 | |
260 | def set_shutter_closed(self): |
261 | @@ -1299,6 +1320,7 @@ |
262 | """ |
263 | log.debug('({ip}) Setting AVMT to 11 (shutter closed)'.format(ip=self.entry.name)) |
264 | self.send_command(cmd='AVMT', opts='11', priority=True) |
265 | + self.status_timer_add('AVMT', self.get_av_mute_status) |
266 | self.poll_loop() |
267 | |
268 | def set_shutter_open(self): |
269 | @@ -1307,8 +1329,51 @@ |
270 | """ |
271 | log.debug('({ip}) Setting AVMT to "10" (shutter open)'.format(ip=self.entry.name)) |
272 | self.send_command(cmd='AVMT', opts='10', priority=True) |
273 | + self.status_timer_add('AVMT', self.get_av_mute_status) |
274 | self.poll_loop() |
275 | - self.projectorUpdateIcons.emit() |
276 | + |
277 | + def status_timer_add(self, cmd, callback): |
278 | + """ |
279 | + Add a callback to the status timer. |
280 | + |
281 | + :param cmd: PJLink command associated with callback |
282 | + :param callback: Method to call |
283 | + """ |
284 | + if cmd in self.status_timer_checks: |
285 | + log.warning('({ip}) "{cmd}" already in checks - returning'.format(ip=self.entry.name, cmd=cmd)) |
286 | + return |
287 | + log.debug('({ip}) Adding "{cmd}" callback for status timer'.format(ip=self.entry.name, cmd=cmd)) |
288 | + if not self.status_timer.isActive(): |
289 | + self.status_timer.start() |
290 | + self.status_timer_checks[cmd] = callback |
291 | + |
292 | + def status_timer_delete(self, cmd): |
293 | + """ |
294 | + Delete a callback from the status timer. |
295 | + |
296 | + :param cmd: PJLink command associated with callback |
297 | + :param callback: Method to call |
298 | + """ |
299 | + if cmd not in self.status_timer_checks: |
300 | + log.warning('({ip}) "{cmd}" not listed in status timer - returning'.format(ip=self.entry.name, cmd=cmd)) |
301 | + return |
302 | + log.debug('({ip}) Removing "{cmd}" from status timer'.format(ip=self.entry.name, cmd=cmd)) |
303 | + self.status_timer_checks.pop(cmd) |
304 | + if not self.status_timer_checks: |
305 | + self.status_timer.stop() |
306 | + |
307 | + def status_timer_update(self): |
308 | + """ |
309 | + Call methods defined in status_timer_checks for updates |
310 | + """ |
311 | + if not self.status_timer_checks: |
312 | + log.warning('({ip}) status_timer_update() called when no callbacks - ' |
313 | + 'Race condition?'.format(ip=self.entry.name)) |
314 | + self.status_timer.stop() |
315 | + return |
316 | + for cmd, callback in self.status_timer_checks.items(): |
317 | + log.debug('({ip}) Status update call for {cmd}'.format(ip=self.entry.name, cmd=cmd)) |
318 | + callback(priority=True) |
319 | |
320 | def receive_data_signal(self): |
321 | """ |
322 | |
323 | === modified file 'openlp/core/version.py' |
324 | --- openlp/core/version.py 2018-03-29 15:54:55 +0000 |
325 | +++ openlp/core/version.py 2018-06-28 17:08:08 +0000 |
326 | @@ -89,7 +89,8 @@ |
327 | while retries < 3: |
328 | try: |
329 | response = requests.get(download_url, headers=headers) |
330 | - remote_version = response.text.strip() |
331 | + if response.status_code == 200: |
332 | + remote_version = response.text.strip() |
333 | log.debug('New version found: %s', remote_version) |
334 | break |
335 | except OSError: |
336 | |
337 | === modified file 'scripts/lp-merge.py' |
338 | --- scripts/lp-merge.py 2018-05-04 21:14:04 +0000 |
339 | +++ scripts/lp-merge.py 2018-06-28 17:08:08 +0000 |
340 | @@ -103,8 +103,8 @@ |
341 | merge_info['branch_url'] = span_branch_url.contents[0] |
342 | # Find the p tag that contains the commit message |
343 | # <div id="commit-message">...<div id="edit-commit_message">...<div class="yui3-editable_text-text"><p> |
344 | - commit_message = soup.find('div', id='commit-message').find('div', id='edit-commit_message')\ |
345 | - .find('div', 'yui3-editable_text-text').p |
346 | + commit_message = soup.find('div', id='commit-message').find('div', id='edit-commit_message') \ |
347 | + .find('div', 'yui3-editable_text-text').p |
348 | merge_info['commit_message'] = commit_message.string |
349 | # Find all tr-tags with this class. Makes it possible to get bug numbers. |
350 | # <tr class="bug-branch-summary" |
351 | |
352 | === modified file 'setup.cfg' |
353 | --- setup.cfg 2017-07-07 23:43:50 +0000 |
354 | +++ setup.cfg 2018-06-28 17:08:08 +0000 |
355 | @@ -12,3 +12,8 @@ |
356 | max-line-length = 120 |
357 | ignore = E402 |
358 | |
359 | +[pycodestyle] |
360 | +exclude = resources.py,vlc.py |
361 | +max-line-length = 120 |
362 | +ignore = E402 |
363 | + |
364 | |
365 | === modified file 'tests/functional/openlp_core/common/test_actions.py' |
366 | --- tests/functional/openlp_core/common/test_actions.py 2017-12-29 09:15:48 +0000 |
367 | +++ tests/functional/openlp_core/common/test_actions.py 2018-06-28 17:08:08 +0000 |
368 | @@ -23,10 +23,11 @@ |
369 | Package to test the openlp.core.common.actions package. |
370 | """ |
371 | from unittest import TestCase |
372 | -from unittest.mock import MagicMock |
373 | +from unittest.mock import MagicMock, call, patch |
374 | |
375 | from PyQt5 import QtGui, QtCore, QtWidgets |
376 | |
377 | +import openlp.core.common.actions |
378 | from openlp.core.common.actions import CategoryActionList, ActionList |
379 | from openlp.core.common.settings import Settings |
380 | from tests.helpers.testmixin import TestMixin |
381 | @@ -139,8 +140,21 @@ |
382 | # THEN: Now the element should not be in the list anymore. |
383 | assert self.action1 not in self.list |
384 | |
385 | - # THEN: Check if an exception is raised when trying to remove a not present action. |
386 | - self.assertRaises(ValueError, self.list.remove, self.action2) |
387 | + def test_remove_not_in_list(self): |
388 | + """ |
389 | + Test the remove() method when action not in list |
390 | + """ |
391 | + with patch.object(openlp.core.common.actions, 'log') as mock_log: |
392 | + log_warn_calls = [call('Action "" does not exist.')] |
393 | + |
394 | + # GIVEN: The list |
395 | + self.list.append(self.action1) |
396 | + |
397 | + # WHEN: Delete an item not in the list. |
398 | + self.list.remove('') |
399 | + |
400 | + # THEN: Warning should be logged |
401 | + mock_log.warning.assert_has_calls(log_warn_calls) |
402 | |
403 | |
404 | class TestActionList(TestCase, TestMixin): |
405 | |
406 | === modified file 'tests/functional/openlp_core/test_version.py' |
407 | --- tests/functional/openlp_core/test_version.py 2018-01-02 21:00:54 +0000 |
408 | +++ tests/functional/openlp_core/test_version.py 2018-06-28 17:08:08 +0000 |
409 | @@ -54,7 +54,7 @@ |
410 | current_version = {'full': '2.0', 'version': '2.0', 'build': None} |
411 | mock_platform.system.return_value = 'Linux' |
412 | mock_platform.release.return_value = '4.12.0-1-amd64' |
413 | - mock_requests.get.return_value = MagicMock(text='2.4.6') |
414 | + mock_requests.get.return_value = MagicMock(text='2.4.6', status_code=200) |
415 | worker = VersionWorker(last_check_date, current_version) |
416 | |
417 | # WHEN: The worker is run |
418 | @@ -79,7 +79,7 @@ |
419 | current_version = {'full': '2.1.3', 'version': '2.1.3', 'build': None} |
420 | mock_platform.system.return_value = 'Linux' |
421 | mock_platform.release.return_value = '4.12.0-1-amd64' |
422 | - mock_requests.get.return_value = MagicMock(text='2.4.6') |
423 | + mock_requests.get.return_value = MagicMock(text='2.4.6', status_code=200) |
424 | worker = VersionWorker(last_check_date, current_version) |
425 | |
426 | # WHEN: The worker is run |
427 | @@ -104,7 +104,7 @@ |
428 | current_version = {'full': '2.1-bzr2345', 'version': '2.1', 'build': '2345'} |
429 | mock_platform.system.return_value = 'Linux' |
430 | mock_platform.release.return_value = '4.12.0-1-amd64' |
431 | - mock_requests.get.return_value = MagicMock(text='2.4.6') |
432 | + mock_requests.get.return_value = MagicMock(text='2.4.6', status_code=200) |
433 | worker = VersionWorker(last_check_date, current_version) |
434 | |
435 | # WHEN: The worker is run |
436 | |
437 | === modified file 'tests/openlp_core/projectors/test_projector_pjlink_base_01.py' |
438 | --- tests/openlp_core/projectors/test_projector_pjlink_base_01.py 2018-05-03 14:58:50 +0000 |
439 | +++ tests/openlp_core/projectors/test_projector_pjlink_base_01.py 2018-06-28 17:08:08 +0000 |
440 | @@ -290,7 +290,7 @@ |
441 | |
442 | # THEN: log data and send_command should have been called |
443 | mock_log.debug.assert_has_calls(log_debug_calls) |
444 | - mock_send_command.assert_called_once_with(cmd=test_data) |
445 | + mock_send_command.assert_called_once_with(cmd=test_data, priority=False) |
446 | |
447 | def test_projector_get_available_inputs(self): |
448 | """ |
449 | @@ -470,7 +470,7 @@ |
450 | |
451 | # THEN: log data and send_command should have been called |
452 | mock_log.debug.assert_has_calls(log_debug_calls) |
453 | - mock_send_command.assert_called_once_with(cmd=test_data) |
454 | + mock_send_command.assert_called_once_with(cmd=test_data, priority=False) |
455 | |
456 | def test_projector_get_status_invalid(self): |
457 | """ |
The fix for version is not correct see inline notes.