diff --git a/galaxy/api/plugin.py b/galaxy/api/plugin.py index cef489e..1fb4bb4 100644 --- a/galaxy/api/plugin.py +++ b/galaxy/api/plugin.py @@ -23,9 +23,10 @@ class JSONEncoder(json.JSONEncoder): return super().default(o) class Plugin(): - def __init__(self, platform, reader, writer, handshake_token): - logging.info("Creating plugin for platform %s", platform.value) + def __init__(self, platform, version, reader, writer, handshake_token): + logging.info("Creating plugin for platform %s, version %s", platform.value, version) self._platform = platform + self._version = version self._feature_methods = OrderedDict() self._active = True diff --git a/tests/conftest.py b/tests/conftest.py index 9c120f2..6b9cc51 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -60,7 +60,7 @@ def plugin(reader, writer): stack.enter_context(patch.object(Plugin, method, new_callable=AsyncMock)) for method in methods: stack.enter_context(patch.object(Plugin, method)) - yield Plugin(Platform.Generic, reader, writer, "token") + yield Plugin(Platform.Generic, "0.1", reader, writer, "token") @pytest.fixture(autouse=True) def my_caplog(caplog): diff --git a/tests/test_features.py b/tests/test_features.py index d307bb7..7f11c17 100644 --- a/tests/test_features.py +++ b/tests/test_features.py @@ -2,14 +2,14 @@ from galaxy.api.plugin import Plugin from galaxy.api.consts import Platform, Feature def test_base_class(): - plugin = Plugin(Platform.Generic, None, None, None) + plugin = Plugin(Platform.Generic, "0.1", None, None, None) assert plugin.features == [] def test_no_overloads(): class PluginImpl(Plugin): #pylint: disable=abstract-method pass - plugin = PluginImpl(Platform.Generic, None, None, None) + plugin = PluginImpl(Platform.Generic, "0.1", None, None, None) assert plugin.features == [] def test_one_method_feature(): @@ -17,7 +17,7 @@ def test_one_method_feature(): async def get_owned_games(self): pass - plugin = PluginImpl(Platform.Generic, None, None, None) + plugin = PluginImpl(Platform.Generic, "0.1", None, None, None) assert plugin.features == [Feature.ImportOwnedGames] def test_multiple_methods_feature_all(): @@ -33,7 +33,7 @@ def test_multiple_methods_feature_all(): async def get_room_history_from_timestamp(self, room_id, timestamp): pass - plugin = PluginImpl(Platform.Generic, None, None, None) + plugin = PluginImpl(Platform.Generic, "0.1", None, None, None) assert plugin.features == [Feature.Chat] def test_multiple_methods_feature_not_all(): @@ -41,5 +41,5 @@ def test_multiple_methods_feature_not_all(): async def send_message(self, room_id, message): pass - plugin = PluginImpl(Platform.Generic, None, None, None) + plugin = PluginImpl(Platform.Generic, "0.1", None, None, None) assert plugin.features == [] diff --git a/tests/test_internal.py b/tests/test_internal.py index 3837c0e..44f8ee7 100644 --- a/tests/test_internal.py +++ b/tests/test_internal.py @@ -15,7 +15,7 @@ def test_get_capabilites(reader, writer, readline, write): "method": "get_capabilities" } token = "token" - plugin = PluginImpl(Platform.Generic, reader, writer, token) + plugin = PluginImpl(Platform.Generic, "0.1", reader, writer, token) readline.side_effect = [json.dumps(request), ""] asyncio.run(plugin.run()) response = json.loads(write.call_args[0][0])