def test_update_library(self, track_for_mbid, album_for_mbid): album_for_mbid.return_value = \ generate_album_info('album id', ['track id']) track_for_mbid.return_value = \ generate_track_info(u'singleton track id', {'title': u'singleton info'}) album_item = Item( album=u'old title', mb_albumid=u'album id', mb_trackid=u'track id', path='' ) album = self.lib.add_album([album_item]) item = Item( title=u'old title', mb_trackid=u'singleton track id', path='', ) self.lib.add(item) self.run_command('mbsync') item.load() self.assertEqual(item.title, u'singleton info') album_item.load() self.assertEqual(album_item.title, u'track info') album.load() self.assertEqual(album.album, u'album info')
def test_update_library(self, track_for_mbid, album_for_mbid): album_for_mbid.return_value = \ generate_album_info('album id', ['track id']) track_for_mbid.return_value = \ generate_track_info('singleton track id', {'title': 'singleton info'}) album_item = Item(album='old title', mb_albumid='album id', mb_trackid='track id', path='') album = self.lib.add_album([album_item]) item = Item( title='old title', mb_trackid='singleton track id', path='', ) self.lib.add(item) self.run_command('mbsync') item.load() self.assertEqual(item.title, 'singleton info') album_item.load() self.assertEqual(album_item.title, 'track info') album.load() self.assertEqual(album.album, 'album info')
def test_update_library(self, track_for_mbid, album_for_mbid): album_for_mbid.return_value = generate_album_info("album id", ["track id"]) track_for_mbid.return_value = generate_track_info(u"singleton track id", {"title": u"singleton info"}) album_item = Item(album=u"old title", mb_albumid=u"album id", mb_trackid=u"track id", path="") album = self.lib.add_album([album_item]) item = Item(title=u"old title", mb_trackid=u"singleton track id", path="") self.lib.add(item) self.run_command("mbsync") item.load() self.assertEqual(item.title, u"singleton info") album_item.load() self.assertEqual(album_item.title, u"track info") album.load() self.assertEqual(album.album, u"album info")
def test_update_library(self, track_for_id, album_for_id): album_for_id.return_value = \ generate_album_info( 'album id', [('track id', {'release_track_id': u'release track id'})] ) track_for_id.return_value = \ generate_track_info(u'singleton track id', {'title': u'singleton info'}) album_item = Item( album=u'old title', mb_albumid=u'81ae60d4-5b75-38df-903a-db2cfa51c2c6', mb_trackid=u'old track id', mb_releasetrackid=u'release track id', path='' ) album = self.lib.add_album([album_item]) item = Item( title=u'old title', mb_trackid=u'b8c2cf90-83f9-3b5f-8ccd-31fb866fcf37', path='', ) self.lib.add(item) with capture_log() as logs: self.run_command('mbsync') self.assertIn('Sending event: albuminfo_received', logs) self.assertIn('Sending event: trackinfo_received', logs) item.load() self.assertEqual(item.title, u'singleton info') album_item.load() self.assertEqual(album_item.title, u'track info') self.assertEqual(album_item.mb_trackid, u'track id') album.load() self.assertEqual(album.album, u'album info')
def test_update_library(self, track_for_id, album_for_id): album_for_id.return_value = \ generate_album_info( 'album id', [('track id', {'release_track_id': u'release track id'})] ) track_for_id.return_value = \ generate_track_info(u'singleton track id', {'title': u'singleton info'}) album_item = Item(album=u'old title', mb_albumid=u'81ae60d4-5b75-38df-903a-db2cfa51c2c6', mb_trackid=u'old track id', mb_releasetrackid=u'release track id', path='') album = self.lib.add_album([album_item]) item = Item( title=u'old title', mb_trackid=u'b8c2cf90-83f9-3b5f-8ccd-31fb866fcf37', path='', ) self.lib.add(item) with capture_log() as logs: self.run_command('mbsync') self.assertIn('Sending event: albuminfo_received', logs) self.assertIn('Sending event: trackinfo_received', logs) item.load() self.assertEqual(item.title, u'singleton info') album_item.load() self.assertEqual(album_item.title, u'track info') self.assertEqual(album_item.mb_trackid, u'track id') album.load() self.assertEqual(album.album, u'album info')