[deps] Fix so it works with older mopidy
Some checks failed
CI / Build (push) Failing after 4m58s
CI / pyright (push) Failing after 6s
CI / pytest (3.13) (push) Failing after 5s
CI / ruff check (push) Failing after 5s
CI / ruff format (push) Failing after 7s
CI / pytest (3.14) (push) Failing after 7s

This commit is contained in:
2026-06-24 19:43:20 -04:00
parent a054575dea
commit 51e0c8a9ad
9 changed files with 355 additions and 162 deletions

View File

@ -1,5 +1,7 @@
from unittest import mock
from mopidy.models import Playlist
from mopidy_smartplaylists.frontend import SmartPlaylistsFrontend
@ -14,11 +16,16 @@ class TestSmartPlaylistsFrontend:
"refresh_interval": "0",
}
core = mock.Mock()
core.library.search.return_value.get.return_value = []
core.playlists.lookup.return_value.get.return_value = None
core.playlists.save.return_value.get.return_value = Playlist(
name="test", uri="dummy:pl", tracks=[]
)
frontend = SmartPlaylistsFrontend(config, core)
frontend.on_start()
core.library.search.assert_called()
assert core.library.search.call_count == 2
def test_on_start_without_recipes(self):
config = mock.Mock()
@ -39,10 +46,16 @@ class TestSmartPlaylistsFrontend:
def test_playlists_loaded_with_interval(self):
config = mock.Mock()
config.get.return_value = {
"decades": "1980",
"playlist_prefix": "[Smart]",
"refresh_interval": "24",
}
core = mock.Mock()
core.library.search.return_value.get.return_value = []
core.playlists.lookup.return_value.get.return_value = None
core.playlists.save.return_value.get.return_value = Playlist(
name="test", uri="dummy:pl", tracks=[]
)
frontend = SmartPlaylistsFrontend(config, core)
frontend.playlists_loaded()