|
14 | 14 |
|
15 | 15 | """Tests for the 'lastgenre' plugin."""
|
16 | 16 |
|
17 |
| -import unittest |
18 | 17 | from unittest.mock import Mock
|
19 | 18 |
|
20 | 19 | import pytest
|
21 | 20 |
|
22 |
| -from beets import config |
23 | 21 | from beets.test import _common
|
| 22 | +from beets.test.helper import BeetsTestCase |
24 | 23 | from beetsplug import lastgenre
|
25 | 24 |
|
26 | 25 |
|
27 |
| -class LastGenrePluginTest(unittest.TestCase): |
| 26 | +class LastGenrePluginTest(BeetsTestCase): |
28 | 27 | def setUp(self):
|
29 | 28 | super().setUp()
|
30 | 29 | self.plugin = lastgenre.LastGenrePlugin()
|
31 | 30 |
|
32 | 31 | def _setup_config(
|
33 | 32 | self, whitelist=False, canonical=False, count=1, prefer_specific=False
|
34 | 33 | ):
|
35 |
| - config["lastgenre"]["canonical"] = canonical |
36 |
| - config["lastgenre"]["count"] = count |
37 |
| - config["lastgenre"]["prefer_specific"] = prefer_specific |
| 34 | + self.config["lastgenre"]["canonical"] = canonical |
| 35 | + self.config["lastgenre"]["count"] = count |
| 36 | + self.config["lastgenre"]["prefer_specific"] = prefer_specific |
38 | 37 | if isinstance(whitelist, (bool, (str,))):
|
39 | 38 | # Filename, default, or disabled.
|
40 |
| - config["lastgenre"]["whitelist"] = whitelist |
| 39 | + self.config["lastgenre"]["whitelist"] = whitelist |
41 | 40 | self.plugin.setup()
|
42 | 41 | if not isinstance(whitelist, (bool, (str,))):
|
43 | 42 | # Explicit list of genres.
|
@@ -463,11 +462,10 @@ def mock_fetch_artist_genre(self, obj):
|
463 | 462 | lastgenre.LastGenrePlugin.fetch_album_genre = mock_fetch_album_genre
|
464 | 463 | lastgenre.LastGenrePlugin.fetch_artist_genre = mock_fetch_artist_genre
|
465 | 464 |
|
466 |
| - # Configure |
467 |
| - config["lastgenre"] = config_values |
468 |
| - |
469 | 465 | # Initialize plugin instance and item
|
470 | 466 | plugin = lastgenre.LastGenrePlugin()
|
| 467 | + # Configure |
| 468 | + plugin.config.set(config_values) |
471 | 469 | item = _common.item()
|
472 | 470 | item.genre = item_genre
|
473 | 471 |
|
|
0 commit comments