Пример #1
0
    def test_start_presentation_with_no_player(self, media_mock):
        """
        Find and chose a controller to play a presentations when the player is not available.
        """
        # GIVEN: A single controller and service item wanting to use the controller
        mock_item = MagicMock()
        mock_item.processor = 'Powerpoint'
        mock_item.get_frame_path.return_value = "test.ppt"
        self.media_item.automatic = False
        mocked_controller = MagicMock()
        mocked_controller.available = True
        mocked_controller.supports = ['ppt']
        mocked_controller1 = MagicMock()
        mocked_controller1.available = False
        mocked_controller1.supports = ['ppt']
        controllers = {
            'Impress': mocked_controller,
            'Powerpoint': mocked_controller1
        }
        ml = MessageListener(self.media_item)
        ml.media_item = self.media_item
        ml.controllers = controllers
        ml.preview_handler = MagicMock()
        ml.timer = MagicMock()

        # WHEN: request the presentation to start
        ml.startup([mock_item, False, False, False])

        # THEN: The controllers will be setup.
        self.assertTrue(len(controllers), 'We have loaded a controller')
Пример #2
0
    def test_start_presentation_with_no_player(self, media_mock):
        """
        Find and chose a controller to play a presentations when the player is not available.
        """
        # GIVEN: A single controller and service item wanting to use the controller
        mock_item = MagicMock()
        mock_item.processor = 'Powerpoint'
        mock_item.get_frame_path.return_value = "test.ppt"
        self.media_item.automatic = False
        mocked_controller = MagicMock()
        mocked_controller.available = True
        mocked_controller.supports = ['ppt']
        mocked_controller1 = MagicMock()
        mocked_controller1.available = False
        mocked_controller1.supports = ['ppt']
        controllers = {
            'Impress': mocked_controller,
            'Powerpoint': mocked_controller1
        }
        ml = MessageListener(self.media_item)
        ml.media_item = self.media_item
        ml.controllers = controllers
        ml.preview_handler = MagicMock()
        ml.timer = MagicMock()

        # WHEN: request the presentation to start
        ml.startup([mock_item, False, False, False])

        # THEN: The controllers will be setup.
        self.assertTrue(len(controllers), 'We have loaded a controller')
Пример #3
0
    def test_start_pdf_presentation(self, media_mock):
        """
        Test the startup of pdf presentation succeed.
        """
        # GIVEN: A sservice item with a pdf
        mock_item = MagicMock()
        mock_item.processor = 'Pdf'
        mock_item.get_frame_path.return_value = "test.pdf"
        self.media_item.generate_slide_data = MagicMock()
        ml = MessageListener(self.media_item)
        ml.media_item = self.media_item
        ml.preview_handler = MagicMock()

        # WHEN: request the presentation to start
        ml.startup([mock_item, False, False, False])

        # THEN: The handler should be set to None
        self.assertIsNone(ml.handler, 'The handler should be None')
Пример #4
0
    def test_start_pdf_presentation(self, media_mock):
        """
        Test the startup of pdf presentation succeed.
        """
        # GIVEN: A sservice item with a pdf
        mock_item = MagicMock()
        mock_item.processor = 'Pdf'
        mock_item.get_frame_path.return_value = "test.pdf"
        self.media_item.generate_slide_data = MagicMock()
        ml = MessageListener(self.media_item)
        ml.media_item = self.media_item
        ml.preview_handler = MagicMock()

        # WHEN: request the presentation to start
        ml.startup([mock_item, False, False, False])

        # THEN: The handler should be set to None
        self.assertIsNone(ml.handler, 'The handler should be None')