Merge lp:~alisonken1/openlp/pjlink2-u into lp:openlp

Proposed by Ken Roberts
Status: Superseded
Proposed branch: lp:~alisonken1/openlp/pjlink2-u
Merge into: lp:openlp
Diff against target: 350 lines (+59/-47)
11 files modified
openlp/core/projectors/db.py (+7/-1)
openlp/core/projectors/manager.py (+13/-28)
openlp/core/projectors/pjlink.py (+15/-4)
openlp/core/ui/icons.py (+8/-4)
setup.cfg (+1/-0)
tests/functional/openlp_core/lib/test_image_manager.py (+2/-2)
tests/functional/openlp_plugins/media/test_mediaplugin.py (+1/-1)
tests/functional/openlp_plugins/songs/test_lib.py (+1/-1)
tests/functional/openlp_plugins/songusage/test_songusage.py (+2/-2)
tests/openlp_core/projectors/test_projector_db.py (+4/-3)
tests/openlp_core/projectors/test_projector_pjlink_commands_01.py (+5/-1)
To merge this branch: bzr merge lp:~alisonken1/openlp/pjlink2-u
Reviewer Review Type Date Requested Status
OpenLP Core Pending
Review via email: mp+364153@code.launchpad.net

This proposal supersedes a proposal from 2019-03-08.

This proposal has been superseded by a proposal from 2019-03-08.

Commit message

PJLink2 Update U

Description of the change

- Fix projector S_ON status icon selection
- Remove unused status items (status icons changed to FA)
- Fix projector icon status update for network errors
    (keep error icon until network reconnects rather than disconnect icon)
- Fix colors to projector toolbar connect/power icons
- Fix toolbar select input icon not always enabled after selecting/connecting projector
- Add max-line-length option for flake8 tests in setup.cfg
- Fix projector tests

--------------------------------------------------------------------------------
lp:~alisonken1/openlp/pjlink2-u (revision 2849)
https://ci.openlp.io/job/Branch-01-Pull/2697/ [SUCCESS]
https://ci.openlp.io/job/Branch-02a-Linux-Tests/2591/ [SUCCESS]
https://ci.openlp.io/job/Branch-02b-macOS-Tests/361/ [FAILURE]
https://ci.openlp.io/job/Branch-03a-Build-Source/191/ [SUCCESS]
https://ci.openlp.io/job/Branch-03b-Build-macOS/170/ [FAILURE]
https://ci.openlp.io/job/Branch-04a-Code-Lint/1653/ [SUCCESS]
https://ci.openlp.io/job/Branch-04b-Test-Coverage/1466/ [SUCCESS]
https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/353/ [FAILURE]

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

Linux tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Linting passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

macOS tests failed, please see https://ci.openlp.io/job/MP-04-macOS-Tests/42/ for more details

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linux tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linting passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

macOS tests failed, please see https://ci.openlp.io/job/MP-04-macOS-Tests/43/ for more details

Revision history for this message
Phill (phill-ridout) wrote : Posted in a previous version of this proposal

Few minor inlines.

review: Needs Fixing
lp:~alisonken1/openlp/pjlink2-u updated
2849. By Ken Roberts

PJLink2 Update U

2850. By Ken Roberts

Minor cleanups

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/projectors/db.py'
--- openlp/core/projectors/db.py 2019-02-14 15:09:09 +0000
+++ openlp/core/projectors/db.py 2019-03-08 15:20:31 +0000
@@ -417,11 +417,17 @@
417 value: (str) From ProjectorSource, Sources tables or PJLink default code list417 value: (str) From ProjectorSource, Sources tables or PJLink default code list
418 """418 """
419 source_dict = {}419 source_dict = {}
420 # Apparently, there was a change to the projector object. Test for which object has db id
421 if hasattr(projector, "id"):
422 chk = projector.id
423 elif hasattr(projector.entry, "id"):
424 chk = projector.entry.id
425
420 # Get default list first426 # Get default list first
421 for key in projector.source_available:427 for key in projector.source_available:
422 item = self.get_object_filtered(ProjectorSource,428 item = self.get_object_filtered(ProjectorSource,
423 and_(ProjectorSource.code == key,429 and_(ProjectorSource.code == key,
424 ProjectorSource.projector_id == projector.id))430 ProjectorSource.projector_id == chk))
425 if item is None:431 if item is None:
426 source_dict[key] = PJLINK_DEFAULT_CODES[key]432 source_dict[key] = PJLINK_DEFAULT_CODES[key]
427 else:433 else:
428434
=== modified file 'openlp/core/projectors/manager.py'
--- openlp/core/projectors/manager.py 2019-02-14 15:09:09 +0000
+++ openlp/core/projectors/manager.py 2019-03-08 15:20:31 +0000
@@ -46,31 +46,10 @@
46from openlp.core.ui.icons import UiIcons46from openlp.core.ui.icons import UiIcons
47from openlp.core.widgets.toolbar import OpenLPToolbar47from openlp.core.widgets.toolbar import OpenLPToolbar
4848
49
50log = logging.getLogger(__name__)49log = logging.getLogger(__name__)
51log.debug('projectormanager loaded')50log.debug('projectormanager loaded')
5251
5352
54# Dict for matching projector status to display icon
55STATUS_ICONS = {
56 S_NOT_CONNECTED: ':/projector/projector_item_disconnect.png',
57 S_CONNECTING: ':/projector/projector_item_connect.png',
58 S_CONNECTED: ':/projector/projector_off.png',
59 S_OFF: ':/projector/projector_off.png',
60 S_INITIALIZE: ':/projector/projector_off.png',
61 S_STANDBY: ':/projector/projector_off.png',
62 S_WARMUP: ':/projector/projector_warmup.png',
63 S_ON: ':/projector/projector_on.png',
64 S_COOLDOWN: ':/projector/projector_cooldown.png',
65 E_ERROR: ':/projector/projector_error.png',
66 E_NETWORK: ':/projector/projector_not_connected_error.png',
67 E_SOCKET_TIMEOUT: ':/projector/projector_not_connected_error.png',
68 E_AUTHENTICATION: ':/projector/projector_not_connected_error.png',
69 E_UNKNOWN_SOCKET_ERROR: ':/projector/projector_not_connected_error.png',
70 E_NOT_CONNECTED: ':/projector/projector_not_connected_error.png'
71}
72
73
74class UiProjectorManager(object):53class UiProjectorManager(object):
75 """54 """
76 UI part of the Projector Manager55 UI part of the Projector Manager
@@ -122,7 +101,7 @@
122 self.one_toolbar.add_toolbar_action('connect_projector',101 self.one_toolbar.add_toolbar_action('connect_projector',
123 text=translate('OpenLP.ProjectorManager',102 text=translate('OpenLP.ProjectorManager',
124 'Connect to selected projector.'),103 'Connect to selected projector.'),
125 icon=UiIcons().projector_connect,104 icon=UiIcons().projector_select_connect,
126 tooltip=translate('OpenLP.ProjectorManager',105 tooltip=translate('OpenLP.ProjectorManager',
127 'Connect to selected projector.'),106 'Connect to selected projector.'),
128 triggers=self.on_connect_projector)107 triggers=self.on_connect_projector)
@@ -136,7 +115,7 @@
136 self.one_toolbar.add_toolbar_action('disconnect_projector',115 self.one_toolbar.add_toolbar_action('disconnect_projector',
137 text=translate('OpenLP.ProjectorManager',116 text=translate('OpenLP.ProjectorManager',
138 'Disconnect from selected projectors'),117 'Disconnect from selected projectors'),
139 icon=UiIcons().projector_disconnect,118 icon=UiIcons().projector_select_disconnect,
140 tooltip=translate('OpenLP.ProjectorManager',119 tooltip=translate('OpenLP.ProjectorManager',
141 'Disconnect from selected projector.'),120 'Disconnect from selected projector.'),
142 triggers=self.on_disconnect_projector)121 triggers=self.on_disconnect_projector)
@@ -151,7 +130,7 @@
151 self.one_toolbar.add_toolbar_action('poweron_projector',130 self.one_toolbar.add_toolbar_action('poweron_projector',
152 text=translate('OpenLP.ProjectorManager',131 text=translate('OpenLP.ProjectorManager',
153 'Power on selected projector'),132 'Power on selected projector'),
154 icon=UiIcons().projector_on,133 icon=UiIcons().projector_power_on,
155 tooltip=translate('OpenLP.ProjectorManager',134 tooltip=translate('OpenLP.ProjectorManager',
156 'Power on selected projector.'),135 'Power on selected projector.'),
157 triggers=self.on_poweron_projector)136 triggers=self.on_poweron_projector)
@@ -164,7 +143,7 @@
164 triggers=self.on_poweron_projector)143 triggers=self.on_poweron_projector)
165 self.one_toolbar.add_toolbar_action('poweroff_projector',144 self.one_toolbar.add_toolbar_action('poweroff_projector',
166 text=translate('OpenLP.ProjectorManager', 'Standby selected projector'),145 text=translate('OpenLP.ProjectorManager', 'Standby selected projector'),
167 icon=UiIcons().projector_off,146 icon=UiIcons().projector_power_off,
168 tooltip=translate('OpenLP.ProjectorManager',147 tooltip=translate('OpenLP.ProjectorManager',
169 'Put selected projector in standby.'),148 'Put selected projector in standby.'),
170 triggers=self.on_poweroff_projector)149 triggers=self.on_poweroff_projector)
@@ -309,7 +288,7 @@
309 S_INITIALIZE: UiIcons().projector_on,288 S_INITIALIZE: UiIcons().projector_on,
310 S_STANDBY: UiIcons().projector_off,289 S_STANDBY: UiIcons().projector_off,
311 S_WARMUP: UiIcons().projector_warmup,290 S_WARMUP: UiIcons().projector_warmup,
312 S_ON: UiIcons().projector_off,291 S_ON: UiIcons().projector_on,
313 S_COOLDOWN: UiIcons().projector_cooldown,292 S_COOLDOWN: UiIcons().projector_cooldown,
314 E_ERROR: UiIcons().projector_error,293 E_ERROR: UiIcons().projector_error,
315 E_NETWORK: UiIcons().error,294 E_NETWORK: UiIcons().error,
@@ -505,7 +484,8 @@
505 projector = list_item.data(QtCore.Qt.UserRole)484 projector = list_item.data(QtCore.Qt.UserRole)
506 try:485 try:
507 projector.link.connect_to_host()486 projector.link.connect_to_host()
508 except Exception:487 except Exception as e:
488 print(e)
509 continue489 continue
510490
511 def on_delete_projector(self, opt=None):491 def on_delete_projector(self, opt=None):
@@ -880,6 +860,7 @@
880 """860 """
881 Update the icons when the selected projectors change861 Update the icons when the selected projectors change
882 """862 """
863 log.debug('update_icons(): Checking for selected projector items in list')
883 count = len(self.projector_list_widget.selectedItems())864 count = len(self.projector_list_widget.selectedItems())
884 projector = None865 projector = None
885 if count == 0:866 if count == 0:
@@ -900,6 +881,7 @@
900 self.get_toolbar_item('blank_projector_multiple', hidden=True)881 self.get_toolbar_item('blank_projector_multiple', hidden=True)
901 self.get_toolbar_item('show_projector_multiple', hidden=True)882 self.get_toolbar_item('show_projector_multiple', hidden=True)
902 elif count == 1:883 elif count == 1:
884 log.debug('update_icons(): Found one item selected')
903 projector = self.projector_list_widget.selectedItems()[0].data(QtCore.Qt.UserRole)885 projector = self.projector_list_widget.selectedItems()[0].data(QtCore.Qt.UserRole)
904 connected = QSOCKET_STATE[projector.link.state()] == S_CONNECTED886 connected = QSOCKET_STATE[projector.link.state()] == S_CONNECTED
905 power = projector.link.power == S_ON887 power = projector.link.power == S_ON
@@ -910,12 +892,14 @@
910 self.get_toolbar_item('blank_projector_multiple', hidden=True)892 self.get_toolbar_item('blank_projector_multiple', hidden=True)
911 self.get_toolbar_item('show_projector_multiple', hidden=True)893 self.get_toolbar_item('show_projector_multiple', hidden=True)
912 if connected:894 if connected:
895 log.debug('update_icons(): Updating icons for connected state')
913 self.get_toolbar_item('view_projector', enabled=True)896 self.get_toolbar_item('view_projector', enabled=True)
914 self.get_toolbar_item('source_view_projector',897 self.get_toolbar_item('source_view_projector',
915 enabled=connected and power and projector.link.source_available is not None)898 enabled=projector.link.source_available is not None and connected and power)
916 self.get_toolbar_item('edit_projector', hidden=True)899 self.get_toolbar_item('edit_projector', hidden=True)
917 self.get_toolbar_item('delete_projector', hidden=True)900 self.get_toolbar_item('delete_projector', hidden=True)
918 else:901 else:
902 log.debug('update_icons(): Updating for not connected state')
919 self.get_toolbar_item('view_projector', hidden=True)903 self.get_toolbar_item('view_projector', hidden=True)
920 self.get_toolbar_item('source_view_projector', hidden=True)904 self.get_toolbar_item('source_view_projector', hidden=True)
921 self.get_toolbar_item('edit_projector', enabled=True)905 self.get_toolbar_item('edit_projector', enabled=True)
@@ -931,6 +915,7 @@
931 self.get_toolbar_item('blank_projector', enabled=False)915 self.get_toolbar_item('blank_projector', enabled=False)
932 self.get_toolbar_item('show_projector', enabled=False)916 self.get_toolbar_item('show_projector', enabled=False)
933 else:917 else:
918 log.debug('update_icons(): Updating for multiple items selected')
934 self.get_toolbar_item('edit_projector', enabled=False)919 self.get_toolbar_item('edit_projector', enabled=False)
935 self.get_toolbar_item('delete_projector', enabled=False)920 self.get_toolbar_item('delete_projector', enabled=False)
936 self.get_toolbar_item('view_projector', hidden=True)921 self.get_toolbar_item('view_projector', hidden=True)
937922
=== modified file 'openlp/core/projectors/pjlink.py'
--- openlp/core/projectors/pjlink.py 2019-02-14 15:09:09 +0000
+++ openlp/core/projectors/pjlink.py 2019-03-08 15:20:31 +0000
@@ -528,8 +528,9 @@
528 sources.append(source)528 sources.append(source)
529 sources.sort()529 sources.sort()
530 self.source_available = sources530 self.source_available = sources
531 log.debug('({ip}) Setting projector sources_available to "{data}"'.format(ip=self.entry.name,531 log.debug('({ip}) Setting projector source_available to "{data}"'.format(ip=self.entry.name,
532 data=self.source_available))532 data=self.source_available))
533 self.projectorUpdateIcons.emit()
533 return534 return
534535
535 def process_lamp(self, data):536 def process_lamp(self, data):
@@ -886,6 +887,9 @@
886 elif status >= S_NOT_CONNECTED and status in QSOCKET_STATE:887 elif status >= S_NOT_CONNECTED and status in QSOCKET_STATE:
887 # Socket connection status update888 # Socket connection status update
888 self.status_connect = status889 self.status_connect = status
890 # Check if we need to update error state as well
891 if self.error_status != S_OK and status != S_NOT_CONNECTED:
892 self.error_status = S_OK
889 elif status >= S_NOT_CONNECTED and status in PROJECTOR_STATE:893 elif status >= S_NOT_CONNECTED and status in PROJECTOR_STATE:
890 # Only affects the projector status894 # Only affects the projector status
891 self.projector_status = status895 self.projector_status = status
@@ -905,7 +909,14 @@
905 message=status_message if msg is None else msg))909 message=status_message if msg is None else msg))
906910
907 # Now that we logged extra information for debugging, broadcast the original change/message911 # Now that we logged extra information for debugging, broadcast the original change/message
908 (code, message) = self._get_status(status)912 # Check for connection errors first
913 if self.error_status != S_OK:
914 log.debug('({ip}) Signalling error code'.format(ip=self.entry.name))
915 (code, message) = self._get_status(self.error_status)
916 status = self.error_status
917 else:
918 log.debug('({ip}) Signalling status code'.format(ip=self.entry.name))
919 (code, message) = self._get_status(status)
909 if msg is not None:920 if msg is not None:
910 message = msg921 message = msg
911 elif message is None:922 elif message is None:
@@ -953,7 +964,7 @@
953 log.error('({ip}) Invalid initial packet received - closing socket'.format(ip=self.entry.name))964 log.error('({ip}) Invalid initial packet received - closing socket'.format(ip=self.entry.name))
954 return self.disconnect_from_host()965 return self.disconnect_from_host()
955 # Convert the initial login prompt with the expected PJLink normal command format for processing966 # Convert the initial login prompt with the expected PJLink normal command format for processing
956 log.debug('({ip}) check_login(): Formatting initial connection prompt'967 log.debug('({ip}) check_login(): Formatting initial connection prompt '
957 'to PJLink packet'.format(ip=self.entry.name))968 'to PJLink packet'.format(ip=self.entry.name))
958 return self.get_data('{start}{clss}{data}'.format(start=PJLINK_PREFIX,969 return self.get_data('{start}{clss}{data}'.format(start=PJLINK_PREFIX,
959 clss='1',970 clss='1',
960971
=== modified file 'openlp/core/ui/icons.py'
--- openlp/core/ui/icons.py 2019-02-15 22:34:53 +0000
+++ openlp/core/ui/icons.py 2019-03-08 15:20:31 +0000
@@ -117,13 +117,17 @@
117 'presentation': {'icon': 'fa.bar-chart'},117 'presentation': {'icon': 'fa.bar-chart'},
118 'preview': {'icon': 'fa.laptop'},118 'preview': {'icon': 'fa.laptop'},
119 'projector': {'icon': 'op.video'},119 'projector': {'icon': 'op.video'},
120 'projector_connect': {'icon': 'fa.plug'},120 'projector_connect': {'icon': 'fa.plug'}, # Projector connect
121 'projector_cooldown': {'icon': 'fa.video-camera', 'attr': 'blue'},121 'projector_cooldown': {'icon': 'fa.video-camera', 'attr': 'blue'},
122 'projector_disconnect': {'icon': 'fa.plug', 'attr': 'lightGray'},122 'projector_disconnect': {'icon': 'fa.plug', 'attr': 'lightGray'}, # Projector disconnect
123 'projector_error': {'icon': 'fa.video-camera', 'attr': 'red'},123 'projector_error': {'icon': 'fa.video-camera', 'attr': 'red'},
124 'projector_hdmi': {'icon': 'op.hdmi'},124 'projector_hdmi': {'icon': 'op.hdmi'},
125 'projector_off': {'icon': 'fa.video-camera', 'attr': 'black'},125 'projector_power_off': {'icon': 'fa.video-camera', 'attr': 'red'}, # Toolbar power off
126 'projector_on': {'icon': 'fa.video-camera', 'attr': 'green'},126 'projector_power_on': {'icon': 'fa.video-camera', 'attr': 'green'}, # Toolbar power on
127 'projector_off': {'icon': 'fa.video-camera', 'attr': 'black'}, # Projector off
128 'projector_on': {'icon': 'fa.video-camera', 'attr': 'green'}, # Projector on
129 'projector_select_connect': {'icon': 'fa.plug', 'attr': 'green'}, # Toolbar connect
130 'projector_select_disconnect': {'icon': 'fa.plug', 'attr': 'red'}, # Toolbar disconnect
127 'projector_warmup': {'icon': 'fa.video-camera', 'attr': 'yellow'},131 'projector_warmup': {'icon': 'fa.video-camera', 'attr': 'yellow'},
128 'picture': {'icon': 'fa.picture-o'},132 'picture': {'icon': 'fa.picture-o'},
129 'print': {'icon': 'fa.print'},133 'print': {'icon': 'fa.print'},
130134
=== modified file 'setup.cfg'
--- setup.cfg 2018-10-30 19:46:55 +0000
+++ setup.cfg 2019-03-08 15:20:31 +0000
@@ -9,6 +9,7 @@
99
10[flake8]10[flake8]
11exclude=resources.py,vlc.py11exclude=resources.py,vlc.py
12max-line-length = 120
12ignore = E402,W503,W504,D13ignore = E402,W503,W504,D
1314
14[pycodestyle]15[pycodestyle]
1516
=== modified file 'tests/functional/openlp_core/lib/test_image_manager.py'
--- tests/functional/openlp_core/lib/test_image_manager.py 2019-02-14 15:09:09 +0000
+++ tests/functional/openlp_core/lib/test_image_manager.py 2019-03-08 15:20:31 +0000
@@ -178,7 +178,7 @@
178 # THEN a KeyError is thrown178 # THEN a KeyError is thrown
179 with self.assertRaises(KeyError) as context:179 with self.assertRaises(KeyError) as context:
180 self.image_manager.get_image(TEST_PATH, 'church1.jpg')180 self.image_manager.get_image(TEST_PATH, 'church1.jpg')
181 assert context.exception is not '', 'KeyError exception should have been thrown for missing image'181 assert context.exception != '', 'KeyError exception should have been thrown for missing image'
182182
183 @patch('openlp.core.lib.imagemanager.run_thread')183 @patch('openlp.core.lib.imagemanager.run_thread')
184 def test_different_dimension_image(self, mocked_run_thread):184 def test_different_dimension_image(self, mocked_run_thread):
@@ -211,7 +211,7 @@
211 # WHEN: calling with correct image, but wrong dimensions211 # WHEN: calling with correct image, but wrong dimensions
212 with self.assertRaises(KeyError) as context:212 with self.assertRaises(KeyError) as context:
213 self.image_manager.get_image(full_path, 'church.jpg', 120, 120)213 self.image_manager.get_image(full_path, 'church.jpg', 120, 120)
214 assert context.exception is not '', 'KeyError exception should have been thrown for missing dimension'214 assert context.exception != '', 'KeyError exception should have been thrown for missing dimension'
215215
216 @patch('openlp.core.lib.imagemanager.resize_image')216 @patch('openlp.core.lib.imagemanager.resize_image')
217 @patch('openlp.core.lib.imagemanager.image_to_byte')217 @patch('openlp.core.lib.imagemanager.image_to_byte')
218218
=== modified file 'tests/functional/openlp_plugins/media/test_mediaplugin.py'
--- tests/functional/openlp_plugins/media/test_mediaplugin.py 2019-02-14 15:09:09 +0000
+++ tests/functional/openlp_plugins/media/test_mediaplugin.py 2019-03-08 15:20:31 +0000
@@ -57,4 +57,4 @@
57 # THEN: about() should return a string object57 # THEN: about() should return a string object
58 assert isinstance(MediaPlugin.about(), str)58 assert isinstance(MediaPlugin.about(), str)
59 # THEN: about() should return a non-empty string59 # THEN: about() should return a non-empty string
60 assert len(MediaPlugin.about()) is not 060 assert len(MediaPlugin.about()) != 0
6161
=== modified file 'tests/functional/openlp_plugins/songs/test_lib.py'
--- tests/functional/openlp_plugins/songs/test_lib.py 2019-02-14 15:09:09 +0000
+++ tests/functional/openlp_plugins/songs/test_lib.py 2019-03-08 15:20:31 +0000
@@ -199,7 +199,7 @@
199 result = _remove_typos(diff)199 result = _remove_typos(diff)
200200
201 # THEN: There should be no typos in the middle anymore. The remaining equals should have been merged.201 # THEN: There should be no typos in the middle anymore. The remaining equals should have been merged.
202 assert len(result) is 1, 'The result should contain only one element.'202 assert len(result) == 1, 'The result should contain only one element.'
203 assert result[0][0] == 'equal', 'The result should contain an equal element.'203 assert result[0][0] == 'equal', 'The result should contain an equal element.'
204 assert result[0][1] == 0, 'The start indices should be kept.'204 assert result[0][1] == 0, 'The start indices should be kept.'
205 assert result[0][2] == 22, 'The stop indices should be kept.'205 assert result[0][2] == 22, 'The stop indices should be kept.'
206206
=== modified file 'tests/functional/openlp_plugins/songusage/test_songusage.py'
--- tests/functional/openlp_plugins/songusage/test_songusage.py 2019-02-14 15:09:09 +0000
+++ tests/functional/openlp_plugins/songusage/test_songusage.py 2019-03-08 15:20:31 +0000
@@ -45,8 +45,8 @@
45 # THEN: about() should return a string object45 # THEN: about() should return a string object
46 assert isinstance(SongUsagePlugin.about(), str)46 assert isinstance(SongUsagePlugin.about(), str)
47 # THEN: about() should return a non-empty string47 # THEN: about() should return a non-empty string
48 assert len(SongUsagePlugin.about()) is not 048 assert len(SongUsagePlugin.about()) != 0
49 assert len(SongUsagePlugin.about()) is not 049 assert len(SongUsagePlugin.about()) != 0
5050
51 @patch('openlp.plugins.songusage.songusageplugin.Manager')51 @patch('openlp.plugins.songusage.songusageplugin.Manager')
52 def test_song_usage_init(self, MockedManager):52 def test_song_usage_init(self, MockedManager):
5353
=== modified file 'tests/openlp_core/projectors/test_projector_db.py'
--- tests/openlp_core/projectors/test_projector_db.py 2019-02-14 15:09:09 +0000
+++ tests/openlp_core/projectors/test_projector_db.py 2019-03-08 15:20:31 +0000
@@ -134,6 +134,7 @@
134 """134 """
135 Set up anything necessary for all tests135 Set up anything necessary for all tests
136 """136 """
137 self.tmp_folder = mkdtemp(prefix='openlp_')
137 # Create a test app to keep from segfaulting138 # Create a test app to keep from segfaulting
138 Registry.create()139 Registry.create()
139 self.registry = Registry()140 self.registry = Registry()
@@ -153,11 +154,11 @@
153 patch('openlp.core.ui.mainwindow.ThemeManager'), \154 patch('openlp.core.ui.mainwindow.ThemeManager'), \
154 patch('openlp.core.ui.mainwindow.ProjectorManager'), \155 patch('openlp.core.ui.mainwindow.ProjectorManager'), \
155 patch('openlp.core.ui.mainwindow.websockets.WebSocketServer'), \156 patch('openlp.core.ui.mainwindow.websockets.WebSocketServer'), \
156 patch('openlp.core.ui.mainwindow.server.HttpServer'):157 patch('openlp.core.ui.mainwindow.server.HttpServer'), \
158 patch('openlp.core.state.State.list_plugins') as mock_plugins:
159 mock_plugins.return_value = []
157 self.main_window = MainWindow()160 self.main_window = MainWindow()
158161
159 # Create a temporary database directory and database
160 self.tmp_folder = mkdtemp(prefix='openlp_')
161 tmpdb_url = 'sqlite:///{db}'.format(db=os.path.join(self.tmp_folder, TEST_DB))162 tmpdb_url = 'sqlite:///{db}'.format(db=os.path.join(self.tmp_folder, TEST_DB))
162 mocked_init_url.return_value = tmpdb_url163 mocked_init_url.return_value = tmpdb_url
163 self.projector = ProjectorDB()164 self.projector = ProjectorDB()
164165
=== modified file 'tests/openlp_core/projectors/test_projector_pjlink_commands_01.py'
--- tests/openlp_core/projectors/test_projector_pjlink_commands_01.py 2019-02-14 15:09:09 +0000
+++ tests/openlp_core/projectors/test_projector_pjlink_commands_01.py 2019-03-08 15:20:31 +0000
@@ -452,12 +452,16 @@
452 """452 """
453 Test saving video source available information453 Test saving video source available information
454 """454 """
455
455 # GIVEN: Test object456 # GIVEN: Test object
456 with patch.object(openlp.core.projectors.pjlink, 'log') as mock_log:457 with patch.object(openlp.core.projectors.pjlink, 'log') as mock_log:
457 pjlink = PJLink(Projector(**TEST1_DATA), no_poll=True)458 pjlink = PJLink(Projector(**TEST1_DATA), no_poll=True)
458 pjlink.source_available = []459 pjlink.source_available = []
459 log_debug_calls = [call('({ip}) Setting projector sources_available to '460 log_debug_calls = [call('({ip}) reset_information() connect status is '
461 'S_NOT_CONNECTED'.format(ip=pjlink.name)),
462 call('({ip}) Setting projector source_available to '
460 '"[\'11\', \'12\', \'21\', \'22\', \'31\', \'32\']"'.format(ip=pjlink.name))]463 '"[\'11\', \'12\', \'21\', \'22\', \'31\', \'32\']"'.format(ip=pjlink.name))]
464
461 chk_data = '21 12 11 22 32 31' # Although they should already be sorted, use unsorted to verify method465 chk_data = '21 12 11 22 32 31' # Although they should already be sorted, use unsorted to verify method
462 chk_test = ['11', '12', '21', '22', '31', '32']466 chk_test = ['11', '12', '21', '22', '31', '32']
463467