Esempio n. 1
0
    def test_load_extensions(self, iter_entry_points_mock):
        mock_entry_point = mock.Mock()
        mock_entry_point.resolve.return_value = DummyExtension

        iter_entry_points_mock.return_value = [mock_entry_point]

        expected = ext.ExtensionData(
            any_testextension, mock_entry_point, IsA(config.ConfigSchema),
            any_unicode, None)

        assert ext.load_extensions() == [expected]
Esempio n. 2
0
from mopidy import config, exceptions, ext

from tests import IsA, any_unicode


class DummyExtension(ext.Extension):
    dist_name = "Mopidy-Foobar"
    ext_name = "foobar"
    version = "1.2.3"

    def get_default_config(self):
        return "[foobar]\nenabled = true"


any_testextension = IsA(DummyExtension)


class TestExtension:
    @pytest.fixture
    def extension(self):
        return ext.Extension()

    def test_dist_name_is_none(self, extension):
        assert extension.dist_name is None

    def test_ext_name_is_none(self, extension):
        assert extension.ext_name is None

    def test_version_is_none(self, extension):
        assert extension.version is None