Small test for PresentationController Constructor

This commit is contained in:
Samuel Mehrbrodt 2013-10-27 13:39:13 +01:00
parent 43f99b81eb
commit abdc3937ef
2 changed files with 51 additions and 4 deletions

View File

@ -292,8 +292,8 @@ class PresentationDocument(object):
class PresentationController(object): class PresentationController(object):
""" """
This class is used to control interactions with presentation applications by creating a runtime environment. This is This class is used to control interactions with presentation applications by creating a runtime environment.
a base class for presentation controllers to inherit from. This is a base class for presentation controllers to inherit from.
To create a new controller, take a copy of this file and name it so it ends with ``controller.py``, i.e. To create a new controller, take a copy of this file and name it so it ends with ``controller.py``, i.e.
``foobarcontroller.py``. Make sure it inherits ``foobarcontroller.py``. Make sure it inherits
@ -341,8 +341,7 @@ class PresentationController(object):
""" """
log.info('PresentationController loaded') log.info('PresentationController loaded')
def __init__(self, plugin=None, name='PresentationController', def __init__(self, plugin=None, name='PresentationController', document_class=PresentationDocument):
document_class=PresentationDocument):
""" """
This is the constructor for the presentationcontroller object. This provides an easy way for descendent plugins This is the constructor for the presentationcontroller object. This provides an easy way for descendent plugins
to populate common data. This method *must* be overridden, like so:: to populate common data. This method *must* be overridden, like so::

View File

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2013 Raoul Snyman #
# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# 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; version 2 of the License. #
# #
# 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, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
This module contains tests for the Presentation Controller.
"""
from unittest import TestCase
from openlp.plugins.presentations.lib.presentationcontroller import PresentationController
from tests.functional import MagicMock
class TestPresentationController(TestCase):
"""
Test the mediaitem methods.
"""
def setUp(self):
"""
Set up the components need for all tests.
"""
self.pres_controller = PresentationController(plugin=MagicMock())
def constructor_test(self):
assert(self.pres_controller.name == "PresentationController")