diff --git a/mopidy/core/playlists.py b/mopidy/core/playlists.py index 878b2b1a..25ae2bdf 100644 --- a/mopidy/core/playlists.py +++ b/mopidy/core/playlists.py @@ -132,11 +132,13 @@ class PlaylistsController(object): futures = [ b.playlists.refresh() for b in self.backends.with_playlists] pykka.get_all(futures) + listener.CoreListener.send('playlists_loaded') else: backend = self.backends.with_playlists_by_uri_scheme.get( uri_scheme, None) if backend: backend.playlists.refresh().get() + listener.CoreListener.send('playlists_loaded') def save(self, playlist): """ diff --git a/tests/core/events_test.py b/tests/core/events_test.py index be991e66..212f3b5d 100644 --- a/tests/core/events_test.py +++ b/tests/core/events_test.py @@ -91,11 +91,15 @@ class BackendEventsTest(unittest.TestCase): self.core.tracklist.shuffle().get() self.assertEqual(send.call_args[0][0], 'tracklist_changed') - @unittest.SkipTest - def test_playlists_load_sends_playlists_loaded_event(self, send): - # TODO Figure out what type of event and how to send events when - # the backend finished loading playlists - pass + def test_playlists_refresh_sends_playlists_loaded_event(self, send): + send.reset_mock() + self.core.playlists.refresh().get() + self.assertEqual(send.call_args[0][0], 'playlists_loaded') + + def test_playlists_refresh_uri_sends_playlists_loaded_event(self, send): + send.reset_mock() + self.core.playlists.refresh(uri_scheme='dummy').get() + self.assertEqual(send.call_args[0][0], 'playlists_loaded') def test_playlists_create_sends_playlist_changed_event(self, send): send.reset_mock()