diff --git a/tests/functional/openlp_core_lib/test_serviceitem.py b/tests/functional/openlp_core_lib/test_serviceitem.py index 8564c8ce4..db8df267f 100644 --- a/tests/functional/openlp_core_lib/test_serviceitem.py +++ b/tests/functional/openlp_core_lib/test_serviceitem.py @@ -244,32 +244,32 @@ class TestServiceItem(TestCase): self.assertEqual(service_item.service_item_type, ServiceItemType.Command, 'It should be a Command') self.assertEqual(service_item.get_frames()[0], frame, 'Frames should match') - def add_from_command_for_a_presentation_thumb_test(self): + @patch('openlp.core.lib.serviceitem.AppLocation.get_section_data_path') + def add_from_command_for_a_presentation_thumb_test(self, mocked_get_section_data_path): """ Test the Service Item - adding a presentation, and updating the thumb path """ - # GIVEN: A service item, a mocked icon and presentation data - with patch('openlp.core.lib.serviceitem.AppLocation.get_section_data_path') as mocked_get_section_data_path: - mocked_get_section_data_path.return_value = os.path.join('mocked', 'section', 'path') - service_item = ServiceItem(None) - service_item.has_original_files = False - service_item.name = 'presentations' - presentation_name = 'test.pptx' - thumb = os.path.join('tmp', 'test', 'thumb.png') - display_title = 'DisplayTitle' - notes = 'Note1\nNote2\n' - expected_thumb_path = os.path.join('mocked', 'section', 'path', 'thumbnails', - md5_hash(os.path.join(TEST_PATH, presentation_name).encode('utf-8')), - 'thumb.png') - frame = {'title': presentation_name, 'image': expected_thumb_path, 'path': TEST_PATH, - 'display_title': display_title, 'notes': notes} + # GIVEN: A service item, a mocked AppLocation and presentation data + mocked_get_section_data_path.return_value = os.path.join('mocked', 'section', 'path') + service_item = ServiceItem(None) + service_item.has_original_files = False + service_item.name = 'presentations' + presentation_name = 'test.pptx' + thumb = os.path.join('tmp', 'test', 'thumb.png') + display_title = 'DisplayTitle' + notes = 'Note1\nNote2\n' + expected_thumb_path = os.path.join('mocked', 'section', 'path', 'thumbnails', + md5_hash(os.path.join(TEST_PATH, presentation_name).encode('utf-8')), + 'thumb.png') + frame = {'title': presentation_name, 'image': expected_thumb_path, 'path': TEST_PATH, + 'display_title': display_title, 'notes': notes} - # WHEN: adding presentation to service_item - service_item.add_from_command(TEST_PATH, presentation_name, thumb, display_title, notes) + # WHEN: adding presentation to service_item + service_item.add_from_command(TEST_PATH, presentation_name, thumb, display_title, notes) - # THEN: verify that it is setup as a Command and that the frame data matches - self.assertEqual(service_item.service_item_type, ServiceItemType.Command, 'It should be a Command') - self.assertEqual(service_item.get_frames()[0], frame, 'Frames should match') + # THEN: verify that it is setup as a Command and that the frame data matches + self.assertEqual(service_item.service_item_type, ServiceItemType.Command, 'It should be a Command') + self.assertEqual(service_item.get_frames()[0], frame, 'Frames should match') def service_item_load_optical_media_from_service_test(self): """