core: Don't fail when adding tracks after end of tracklist
This commit is contained in:
parent
ae9a257091
commit
8f1b98b306
@ -78,9 +78,6 @@ class TracklistController(object):
|
||||
:type at_position: int or :class:`None`
|
||||
:rtype: list of :class:`mopidy.models.TlTrack`
|
||||
"""
|
||||
assert at_position is None or at_position <= len(self._tl_tracks), \
|
||||
'at_position can not be greater than tracklist length'
|
||||
|
||||
tl_tracks = []
|
||||
for track in tracks:
|
||||
tl_track = TlTrack(self._next_tlid, track)
|
||||
|
||||
@ -50,9 +50,11 @@ class TracklistControllerTest(object):
|
||||
|
||||
@populate_tracklist
|
||||
def test_add_at_position_outside_of_playlist(self):
|
||||
test = lambda: self.controller.add(
|
||||
self.tracks[0], len(self.tracks) + 2)
|
||||
self.assertRaises(AssertionError, test)
|
||||
for track in self.tracks:
|
||||
tl_tracks = self.controller.add([track], len(self.tracks) + 2)
|
||||
self.assertEqual(track, self.controller.tracks[-1])
|
||||
self.assertEqual(tl_tracks[0], self.controller.tl_tracks[-1])
|
||||
self.assertEqual(track, tl_tracks[0].track)
|
||||
|
||||
@populate_tracklist
|
||||
def test_filter_by_tlid(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user