Exemple #1
0
    def test_check_available(self, mocked_log):
        """
        Test `ImpressController.check_available` on Windows
        """
        # GIVEN: An instance of :class:`ImpressController`
        controller = ImpressController(plugin=self.mock_plugin)

        # WHEN: `check_available` is called on Windows and `get_com_servicemanager` returns None
        with patch('openlp.plugins.presentations.lib.impresscontroller.is_win', return_value=True), \
                patch.object(controller, 'get_com_servicemanager', return_value=None) as mocked_get_com_servicemanager:
            result = controller.check_available()

            # THEN: `check_available` should return False
            assert mocked_get_com_servicemanager.called is True
            assert result is False
    def test_check_available_on_linux(self, mocked_is_win, mocked_log):
        """
        Test `ImpressController.check_available` when not on Windows
        """
        # GIVEN: An instance of :class:`ImpressController`
        controller = ImpressController(plugin=self.mock_plugin)

        # WHEN: `check_available` is called on Windows and `uno_available` is True
        with patch('openlp.plugins.presentations.lib.impresscontroller.uno_available', True), \
                patch.object(controller, 'get_com_servicemanager') as mocked_get_com_servicemanager:
            result = controller.check_available()

            # THEN: `check_available` should return True
            assert mocked_get_com_servicemanager.called is False
            assert result is True