def setUp(self): """ Set up the patches and mocks need for all tests. """ self.setup_application() self.build_settings() self.mock_plugin = MagicMock() self.temp_folder = mkdtemp() self.mock_plugin.settings_section = self.temp_folder self.powerpoint_document_stop_presentation_patcher = patch( 'openlp.plugins.presentations.lib.powerpointcontroller.PowerpointDocument.stop_presentation' ) self.presentation_document_get_temp_folder_patcher = patch( 'openlp.plugins.presentations.lib.powerpointcontroller.PresentationDocument.get_temp_folder' ) self.presentation_document_setup_patcher = patch( 'openlp.plugins.presentations.lib.powerpointcontroller.PresentationDocument._setup' ) self.mock_powerpoint_document_stop_presentation = self.powerpoint_document_stop_presentation_patcher.start( ) self.mock_presentation_document_get_temp_folder = self.presentation_document_get_temp_folder_patcher.start( ) self.mock_presentation_document_setup = self.presentation_document_setup_patcher.start( ) self.mock_controller = MagicMock() self.mock_presentation = MagicMock() self.mock_presentation_document_get_temp_folder.return_value = 'temp folder' self.file_name = os.path.join(TEST_RESOURCES_PATH, 'presentations', 'test.pptx') self.real_controller = PowerpointController(self.mock_plugin) Settings().extend_default_settings(__default_settings__)
def test_constructor(self): """ Test the Constructor from the PowerpointController """ # GIVEN: No presentation controller controller = None # WHEN: The presentation controller object is created controller = PowerpointController(plugin=self.mock_plugin) # THEN: The name of the presentation controller should be correct assert 'Powerpoint' == controller.name, 'The name of the presentation controller should be correct'