Exemplo n.º 1
0
 def create_media_manager_item(self):
     """
     Create the Media Manager List.
     """
     self.media_item = PresentationMediaItem(
         self.main_window.media_dock_manager.media_dock, self,
         self.controllers)
Exemplo n.º 2
0
 def setUp(self):
     """
     Set up the components need for all tests.
     """
     Registry.create()
     Registry().register('service_manager', MagicMock())
     Registry().register('main_window', MagicMock())
     with patch('openlp.plugins.presentations.lib.mediaitem.MediaManagerItem._setup'), \
             patch('openlp.plugins.presentations.lib.mediaitem.PresentationMediaItem.setup_item'):
         self.media_item = PresentationMediaItem(None, MagicMock,
                                                 MagicMock())
Exemplo n.º 3
0
    def test_search(self, mocked_settings, *unreferenced_mocks):
        """
        Test that the search method finds the correct results
        """
        # GIVEN: A mocked Settings class which returns a list of Path objects,
        #        and an instance of the PresentationMediaItem
        path_1 = Path('some_dir', 'Impress_file_1')
        path_2 = Path('some_other_dir', 'impress_file_2')
        path_3 = Path('another_dir', 'ppt_file')
        mocked_returned_settings = MagicMock()
        mocked_returned_settings.value.return_value = [path_1, path_2, path_3]
        mocked_settings.return_value = mocked_returned_settings
        media_item = PresentationMediaItem(None, MagicMock(), None)
        media_item.settings_section = ''

        # WHEN: Calling search
        results = media_item.search('IMPRE', False)

        # THEN: The first two results should have been returned
        assert results == [[str(path_1), 'Impress_file_1'], [str(path_2), 'impress_file_2']]