Source

moin-2.0 / MoinMoin / _tests / test_plugin.py

Full commit
# Copyright: 2012 MoinMoin:MiksKalnins <mikskalnins@maikumori.com>
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
    MoinMoin - MoinMoin.plugin Tests
"""

import pytest
import sys

from MoinMoin import plugin

class MoinTestPlugin(plugin.PluginBase):

    name = u"Test Plugin"
    author = u"Test Test"
    description = u"Test Plugin."


class TestSimple(object):

    pytest.importorskip("ExampleMoinPlugin")
    def test_loading(self):
        """Just a placeholder."""
        example_module = "ExampleMoinPlugin"

        plugin.load([example_module], False)

        assert(example_module in sys.modules)

    pytest.importorskip("ExampleMoinPlugin")
    def test_initializing(self):
        plugins = plugin.init_all_plugins({}, False)
        class_id = "{0}.{1}".format(MoinTestPlugin.__module__, MoinTestPlugin.__name__)
        assert(class_id in plugins)