2015-03-10 21:33:35 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-04-13 13:00:22 +00:00
|
|
|
##########################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# ---------------------------------------------------------------------- #
|
|
|
|
# Copyright (c) 2008-2019 OpenLP Developers #
|
|
|
|
# ---------------------------------------------------------------------- #
|
|
|
|
# This program is free software: you can redistribute it and/or modify #
|
|
|
|
# it under the terms of the GNU General Public License as published by #
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or #
|
|
|
|
# (at your option) any later version. #
|
|
|
|
# #
|
|
|
|
# This program is distributed in the hope that it will be useful, #
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
|
|
# GNU General Public License for more details. #
|
|
|
|
# #
|
|
|
|
# You should have received a copy of the GNU General Public License #
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
|
|
|
##########################################################################
|
2015-03-10 21:33:35 +00:00
|
|
|
"""
|
|
|
|
Test the media plugin
|
|
|
|
"""
|
|
|
|
from unittest import TestCase
|
2017-10-10 07:08:44 +00:00
|
|
|
from unittest.mock import patch
|
2015-03-10 21:33:35 +00:00
|
|
|
|
2017-10-10 07:08:44 +00:00
|
|
|
from openlp.core.common.registry import Registry
|
2018-12-01 14:41:40 +00:00
|
|
|
from openlp.plugins.media.mediaplugin import MediaPlugin
|
2015-03-10 21:33:35 +00:00
|
|
|
from tests.helpers.testmixin import TestMixin
|
|
|
|
|
|
|
|
|
|
|
|
class MediaPluginTest(TestCase, TestMixin):
|
|
|
|
"""
|
|
|
|
Test the media plugin
|
|
|
|
"""
|
|
|
|
def setUp(self):
|
|
|
|
Registry.create()
|
|
|
|
|
2017-08-12 17:45:56 +00:00
|
|
|
@patch('openlp.plugins.media.mediaplugin.Plugin.initialise')
|
|
|
|
def test_initialise(self, mocked_initialise):
|
2015-03-10 21:33:35 +00:00
|
|
|
"""
|
|
|
|
Test that the initialise() method overwrites the built-in one, but still calls it
|
|
|
|
"""
|
2017-08-12 17:45:56 +00:00
|
|
|
# GIVEN: A media plugin instance
|
2015-03-10 21:33:35 +00:00
|
|
|
media_plugin = MediaPlugin()
|
|
|
|
|
|
|
|
# WHEN: initialise() is called
|
|
|
|
media_plugin.initialise()
|
|
|
|
|
2017-08-12 17:45:56 +00:00
|
|
|
# THEN: The the base initialise() method should be called
|
2015-03-10 21:33:35 +00:00
|
|
|
mocked_initialise.assert_called_with()
|
2016-01-04 00:28:13 +00:00
|
|
|
|
|
|
|
def test_about_text(self):
|
|
|
|
# GIVEN: The MediaPlugin
|
|
|
|
# WHEN: Retrieving the about text
|
|
|
|
# THEN: about() should return a string object
|
2017-12-22 16:53:40 +00:00
|
|
|
assert isinstance(MediaPlugin.about(), str)
|
2016-01-04 00:28:13 +00:00
|
|
|
# THEN: about() should return a non-empty string
|
2019-03-08 15:19:57 +00:00
|
|
|
assert len(MediaPlugin.about()) != 0
|