[deps] Fix so it works with older mopidy
Some checks failed
Some checks failed
This commit is contained in:
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user