

def test_searchaddpl_appends_to_existing_playlist(self):
    playlist = self.core.playlists.create('my favs').get()
    playlist = playlist.replace(tracks=[Track(uri='dummy:x', name='X'), Track(uri='dummy:y', name='y')])
    self.core.playlists.save(playlist)
    self.backend.library.dummy_search_result = SearchResult(tracks=[Track(uri='dummy:a', name='A')])
    items = self.core.playlists.get_items(playlist.uri).get()
    self.assertEqual(len(items), 2)
    self.send_request('searchaddpl "my favs" "title" "a"')
    items = self.core.playlists.get_items(playlist.uri).get()
    self.assertEqual(len(items), 3)
    self.assertEqual(items[0].uri, 'dummy:x')
    self.assertEqual(items[1].uri, 'dummy:y')
    self.assertEqual(items[2].uri, 'dummy:a')
    self.assertInResponse('OK')

dataset/ETHPy150Open mopidy/mopidy/tests/mpd/protocol/test_music_db.py MusicDatabaseHandlerTest.test_searchaddpl_appends_to_existing_playlist/original