def setUp(self):
    super(ArtImporterTest, self).setUp()
    self.art_file = os.path.join(self.temp_dir, 'tmpcover.jpg')
    _common.touch(self.art_file)
    self.old_afa = self.plugin.art_for_album
    self.afa_response = self.art_file

    def art_for_album(i, p, local_only=False):
        return self.afa_response
    self.plugin.art_for_album = art_for_album
    self.libpath = os.path.join(self.temp_dir, 'tmplib.blb')
    self.libdir = os.path.join(self.temp_dir, 'tmplib')
    os.mkdir(self.libdir)
    os.mkdir(os.path.join(self.libdir, 'album'))
    itempath = os.path.join(self.libdir, 'album', 'test.mp3')
    shutil.copyfile(os.path.join(_common.RSRC, 'full.mp3'), itempath)
    self.lib = library.Library(self.libpath)
    self.i = _common.item()
    self.i.path = itempath
    self.album = self.lib.add_album([self.i])
    self.lib._connection().commit()
    self.session = _common.import_session(self.lib)
    self.task = importer.ImportTask(None, None, [self.i])
    self.task.is_album = True
    self.task.album = self.album
    info = AlbumInfo(album='some album', album_id='albumid', artist='some artist', artist_id='artistid', tracks=[])
    self.task.set_choice(AlbumMatch(0, info, {}, set(), set()))
def setUp(self):
    super(ArtImporterTest, self).setUp()
    self.art_file = os.path.join(self.temp_dir, 'tmpcover.jpg')
    _common.touch(self.art_file)
    self.old_afa = self.plugin.art_for_album
    self.afa_response = self.art_file

    def art_for_album(i, p, local_only=False):
        return self.afa_response
    self.plugin.art_for_album = art_for_album
    self.libpath = os.path.join(self.temp_dir, 'tmplib.blb')
    self.libdir = os.path.join(self.temp_dir, 'tmplib')
    os.mkdir(self.libdir)
    os.mkdir(os.path.join(self.libdir, 'album'))
    itempath = os.path.join(self.libdir, 'album', 'test.mp3')
    shutil.copyfile(os.path.join(_common.RSRC, 'full.mp3'), itempath)
    self.lib = library.Library(self.libpath)
    self.i = _common.item()
    self.i.path = itempath
    self.album = self.lib.add_album([self.i])
    self.lib._connection().commit()
    self.session = _common.import_session(self.lib)
    self.task = importer.ImportTask(None, None, [self.i])
    self.task.is_album = True
    self.task.album = self.album
    info = AlbumInfo(album='some album', album_id='albumid', artist='some artist', artist_id='artistid', tracks=[])
    self.task.set_choice(AlbumMatch(0, info, {}, set(), set()))