<s> from __future__ import division , absolute_import , print_function <EOL> from mock import patch <EOL> from test . _common import unittest <EOL> from test . helper import TestHelper , generate_album_info , generate_track_info , capture_log <EOL> from beets import config <EOL> from beets . library import Item <EOL> class MbsyncCliTest ( unittest . TestCase , TestHelper ) : <EOL> def setUp ( self ) : <EOL> self . setup_beets ( ) <EOL> self . load_plugins ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . unload_plugins ( ) <EOL> self . teardown_beets ( ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_update_library ( self , track_for_mbid , album_for_mbid ) : <EOL> album_for_mbid . return_value = generate_album_info ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> track_for_mbid . return_value = generate_track_info ( u'<STR_LIT>' , <EOL> { '<STR_LIT:title>' : u'<STR_LIT>' } ) <EOL> album_item = Item ( <EOL> album = u'<STR_LIT>' , <EOL> mb_albumid = u'<STR_LIT>' , <EOL> mb_trackid = u'<STR_LIT>' , <EOL> path = '<STR_LIT>' <EOL> ) <EOL> album = self . lib . add_album ( [ album_item ] ) <EOL> item = Item ( <EOL> title = u'<STR_LIT>' , <EOL> mb_trackid = u'<STR_LIT>' , <EOL> path = '<STR_LIT>' , <EOL> ) <EOL> self . lib . add ( item ) <EOL> self . run_command ( '<STR_LIT>' ) <EOL> item . load ( ) <EOL> self . assertEqual ( item . title , u'<STR_LIT>' ) <EOL> album_item . load ( ) <EOL> self . assertEqual ( album_item . title , u'<STR_LIT>' ) <EOL> album . load ( ) <EOL> self . assertEqual ( album . album , u'<STR_LIT>' ) <EOL> def test_message_when_skipping ( self ) : <EOL> config [ '<STR_LIT>' ] = u'<STR_LIT>' <EOL> config [ '<STR_LIT>' ] = u'<STR_LIT>' <EOL> album_invalid = Item ( <EOL> albumartist = u'<STR_LIT>' , <EOL> album = u'<STR_LIT>' , <EOL> path = '<STR_LIT>' <EOL> ) <EOL> self . lib . add_album ( [ album_invalid ] ) <EOL> with capture_log ( '<STR_LIT>' ) as logs : <EOL> self . run_command ( '<STR_LIT>' ) <EOL> e = u'<STR_LIT>' + u'<STR_LIT>' <EOL> self . assertEqual ( e , logs [ <NUM_LIT:0> ] ) <EOL> with capture_log ( '<STR_LIT>' ) as logs : <EOL> self . run_command ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" ) <EOL> e = u"<STR_LIT>" <EOL> self . assertEqual ( e , logs [ <NUM_LIT:0> ] ) <EOL> config [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> config [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> item_invalid = Item ( <EOL> artist = u'<STR_LIT>' , <EOL> album = u'<STR_LIT>' , <EOL> title = u'<STR_LIT>' , <EOL> path = '<STR_LIT>' , <EOL> ) <EOL> self . lib . add ( item_invalid ) <EOL> with capture_log ( '<STR_LIT>' ) as logs : <EOL> self . run_command ( '<STR_LIT>' ) <EOL> e = u'<STR_LIT>' + u'<STR_LIT>' <EOL> self . assertEqual ( e , logs [ <NUM_LIT:0> ] ) <EOL> with capture_log ( '<STR_LIT>' ) as logs : <EOL> self . run_command ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" ) <EOL> e = u"<STR_LIT>" <EOL> self . assertEqual ( e , logs [ <NUM_LIT:0> ] ) <EOL> def suite ( ) : <EOL> return unittest . TestLoader ( ) . loadTestsFromName ( __name__ ) <EOL> if __name__ == b'<STR_LIT:__main__>' : <EOL> unittest . main ( defaultTest = '<STR_LIT>' ) </s>
