mirror of
https://github.com/beetbox/beets.git
synced 2026-02-21 14:56:02 +01:00
fix translation of the old remote_priority option for fetchart, add a test
This commit is contained in:
parent
3fb2185925
commit
8169983074
2 changed files with 21 additions and 2 deletions
|
|
@ -694,8 +694,8 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
|
|||
u'been deprecated, see the documentation.')
|
||||
if self.config['remote_priority'].get(bool):
|
||||
try:
|
||||
self.sources_name.remove[u'filesystem']
|
||||
sources_name.append[u'filesystem']
|
||||
sources_name.remove(u'filesystem')
|
||||
sources_name.append(u'filesystem')
|
||||
except ValueError:
|
||||
pass
|
||||
self.sources = [ART_SOURCES[s](self._log, self.config)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ from test import _common
|
|||
from test._common import unittest
|
||||
from beetsplug import fetchart
|
||||
from beets.autotag import AlbumInfo, AlbumMatch
|
||||
from beets import config
|
||||
from beets import library
|
||||
from beets import importer
|
||||
from beets import logging
|
||||
|
|
@ -540,6 +541,24 @@ class ArtForAlbumTest(UseThePlugin):
|
|||
self._assertImageResized(self.IMG_348x348, True)
|
||||
|
||||
|
||||
class DeprecatedConfigTest(_common.TestCase):
|
||||
"""While refactoring the plugin, the remote_priority option was deprecated,
|
||||
and a new codepath should translate its effect. Check that it actually does
|
||||
so.
|
||||
"""
|
||||
|
||||
# If we subclassed UseThePlugin, the configuration change would either be
|
||||
# overwritten by _common.TestCase or be set after constructing the
|
||||
# plugin object
|
||||
def setUp(self):
|
||||
super(DeprecatedConfigTest, self).setUp()
|
||||
config['fetchart']['remote_priority'] = True
|
||||
self.plugin = fetchart.FetchArtPlugin()
|
||||
|
||||
def test_moves_filesystem_to_end(self):
|
||||
self.assertEqual(type(self.plugin.sources[-1]), fetchart.FileSystem)
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue