Merge remote-tracking branch 'upstream/release-1.1' into fix/1378

This commit is contained in:
jcass 2016-01-04 00:04:42 +02:00
commit 4e63e4280c
3 changed files with 17 additions and 3 deletions

View File

@ -31,6 +31,9 @@ Bug fix release.
- MPD: Don't return tracks with empty URIs. (Partly fixes: :issue:`1340`, PR:
:issue:`1343`)
- Core: Make :meth:`~mopidy.core.LibraryController.lookup` ignore tracks with
empty URIs. (Partly fixes: :issue:`1340`, PR: :issue:`1381`)
v1.1.1 (2015-09-14)
===================

View File

@ -236,7 +236,9 @@ class LibraryController(object):
result = future.get()
if result is not None:
validation.check_instances(result, models.Track)
results[u] = result
# TODO Consider making Track.uri field mandatory, and
# then remove this filtering of tracks without URIs.
results[u] = [r for r in result if r.uri]
if uri:
return results[uri]

View File

@ -153,8 +153,8 @@ class CoreLibraryTest(BaseCoreLibraryTest):
self.core.library.lookup('dummy1:a', ['dummy2:a'])
def test_lookup_can_handle_uris(self):
track1 = Track(name='abc')
track2 = Track(name='def')
track1 = Track(uri='dummy1:a', name='abc')
track2 = Track(uri='dummy2:a', name='def')
self.library1.lookup().get.return_value = [track1]
self.library2.lookup().get.return_value = [track2]
@ -169,6 +169,15 @@ class CoreLibraryTest(BaseCoreLibraryTest):
self.assertFalse(self.library1.lookup.called)
self.assertFalse(self.library2.lookup.called)
def test_lookup_ignores_tracks_without_uri_set(self):
track1 = Track(uri='dummy1:a', name='abc')
track2 = Track()
self.library1.lookup().get.return_value = [track1, track2]
result = self.core.library.lookup(uris=['dummy1:a'])
self.assertEqual(result, {'dummy1:a': [track1]})
def test_refresh_with_uri_selects_dummy1_backend(self):
self.core.library.refresh('dummy1:a')