From f2537981e4e9287fa4e5b5aae3a369060013a019 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 20 Apr 2016 17:36:37 +0100 Subject: [PATCH] update --- openlp/core/common/__init__.py | 1 - openlp/plugins/media/mediaplugin.py | 5 ++-- .../openlp_plugins/media/test_mediaplugin.py | 24 ++++++++++++++++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/openlp/core/common/__init__.py b/openlp/core/common/__init__.py index a1ce05abd..2c32a75d0 100644 --- a/openlp/core/common/__init__.py +++ b/openlp/core/common/__init__.py @@ -253,7 +253,6 @@ if is_win(): from subprocess import STARTUPINFO, STARTF_USESHOWWINDOW - def add_actions(target, actions): """ Adds multiple actions to a menu or toolbar in one command. diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 4f9c4a0b1..5f3f4f3ef 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -153,11 +153,10 @@ class MediaPlugin(Plugin): def process_check_binary(program_path): """ - Function that checks whether a binary is either ghostscript or mudraw or neither. - Is also used from presentationtab.py + Function that checks whether a binary MediaInfo is present :param program_path:The full path to the binary to check. - :return: Type of the binary, 'gs' if ghostscript, 'mudraw' if mudraw, None if invalid. + :return: If exists or not """ program_type = None runlog = check_binary(program_path) diff --git a/tests/functional/openlp_plugins/media/test_mediaplugin.py b/tests/functional/openlp_plugins/media/test_mediaplugin.py index 1e11de4fa..e7852fb0c 100644 --- a/tests/functional/openlp_plugins/media/test_mediaplugin.py +++ b/tests/functional/openlp_plugins/media/test_mediaplugin.py @@ -25,7 +25,7 @@ Test the media plugin from unittest import TestCase from openlp.core import Registry -from openlp.plugins.media.mediaplugin import MediaPlugin +from openlp.plugins.media.mediaplugin import MediaPlugin, process_check_binary from tests.functional import MagicMock, patch from tests.helpers.testmixin import TestMixin @@ -63,3 +63,25 @@ class MediaPluginTest(TestCase, TestMixin): self.assertIsInstance(MediaPlugin.about(), str) # THEN: about() should return a non-empty string self.assertNotEquals(len(MediaPlugin.about()), 0) + + def process_check_binary_pass_test(self): + """ + Test that the Process check returns true if found + """ + # GIVEN: A media plugin instance + # WHEN: function is called with the correct name + result = process_check_binary("MediaInfo") + + # THEN: The the result should be True + self.assertFalse(result, "Media info should have been found") + + def process_check_binary_fail_test(self): + """ + Test that the Process check returns false if not found + """ + # GIVEN: A media plugin instance + # WHEN: function is called with the wrong name + result = process_check_binary("MediaInfo1") + + # THEN: The the result should be True + self.assertTrue(result, "Media info should not have been found")