예제 #1
0
    def test_on_double_clicked_go_live(self, mocked_on_live_click, MockedSettings):
        """
        Test that when "Double-click to go live" is enabled that the item goes live
        """
        # GIVEN: A setting to enable "Double-click to go live" and a media manager item
        mocked_settings = MagicMock()
        mocked_settings.value.side_effect = lambda x: x == 'advanced/double click live'
        MockedSettings.return_value = mocked_settings
        mmi = MediaManagerItem(None)

        # WHEN: on_double_clicked() is called
        mmi.on_double_clicked()

        # THEN: on_live_click() should have been called
        mocked_on_live_click.assert_called_with()
예제 #2
0
    def test_on_double_clicked(self, mocked_on_preview_click, MockedSettings):
        """
        Test that when an item is double-clicked then the item is previewed
        """
        # GIVEN: A setting to enable "Double-click to go live" and a media manager item
        mocked_settings = MagicMock()
        mocked_settings.value.return_value = False
        MockedSettings.return_value = mocked_settings
        mmi = MediaManagerItem(None)

        # WHEN: on_double_clicked() is called
        mmi.on_double_clicked()

        # THEN: on_preview_click() should have been called
        mocked_on_preview_click.assert_called_with()
예제 #3
0
    def on_double_clicked_go_live_test(self, mocked_on_live_click, MockedSettings):
        """
        Test that when "Double-click to go live" is enabled that the item goes live
        """
        # GIVEN: A setting to enable "Double-click to go live" and a media manager item
        mocked_settings = MagicMock()
        mocked_settings.value.side_effect = lambda x: x == 'advanced/double click live'
        MockedSettings.return_value = mocked_settings
        mmi = MediaManagerItem(None)

        # WHEN: on_double_clicked() is called
        mmi.on_double_clicked()

        # THEN: on_live_click() should have been called
        mocked_on_live_click.assert_called_with()
예제 #4
0
    def on_double_clicked_test(self, mocked_on_preview_click, MockedSettings):
        """
        Test that when an item is double-clicked then the item is previewed
        """
        # GIVEN: A setting to enable "Double-click to go live" and a media manager item
        mocked_settings = MagicMock()
        mocked_settings.value.return_value = False
        MockedSettings.return_value = mocked_settings
        mmi = MediaManagerItem(None)

        # WHEN: on_double_clicked() is called
        mmi.on_double_clicked()

        # THEN: on_preview_click() should have been called
        mocked_on_preview_click.assert_called_with()
예제 #5
0
    def test_on_double_clicked_single_click_preview(self, mocked_on_preview_click, mocked_on_live_click,
                                                    MockedSettings):
        """
        Test that when "Single-click preview" is enabled then nothing happens on double-click
        """
        # GIVEN: A setting to enable "Double-click to go live" and a media manager item
        mocked_settings = MagicMock()
        mocked_settings.value.side_effect = lambda x: x == 'advanced/single click preview'
        MockedSettings.return_value = mocked_settings
        mmi = MediaManagerItem(None)

        # WHEN: on_double_clicked() is called
        mmi.on_double_clicked()

        # THEN: on_live_click() should have been called
        self.assertEqual(0, mocked_on_live_click.call_count, u'on_live_click() should not have been called')
        self.assertEqual(0, mocked_on_preview_click.call_count, u'on_preview_click() should not have been called')
예제 #6
0
    def on_double_clicked_single_click_preview_test(self, mocked_on_preview_click, mocked_on_live_click,
                                                    MockedSettings):
        """
        Test that when "Single-click preview" is enabled then nothing happens on double-click
        """
        # GIVEN: A setting to enable "Double-click to go live" and a media manager item
        mocked_settings = MagicMock()
        mocked_settings.value.side_effect = lambda x: x == 'advanced/single click preview'
        MockedSettings.return_value = mocked_settings
        mmi = MediaManagerItem(None)

        # WHEN: on_double_clicked() is called
        mmi.on_double_clicked()

        # THEN: on_live_click() should have been called
        self.assertEqual(0, mocked_on_live_click.call_count, u'on_live_click() should not have been called')
        self.assertEqual(0, mocked_on_preview_click.call_count, u'on_preview_click() should not have been called')