lastgenre: Add test ensuring next stage is hit

If no album was found the next stage (artist) should be entered, the
original genre kicked out (not whitelisted) and artist genre accepted.
The log message is slightly misleading since it tried to keep existing
genres but they were not whitelisted, thus kicked out. This is expected.
This commit is contained in:
J0J0 Todos 2025-03-26 11:43:10 +01:00
parent 68202f3498
commit de9020055d

View file

@ -292,24 +292,24 @@ class LastGenrePluginTest(BeetsTestCase):
},
("Unknown Genre, Jazz", "keep + artist, any"),
),
# 7 - fallback to original when nothing found
# 7 - fallback to any original when nothing found and whitelist disabled
(
{
"force": True,
"keep_existing": True,
"source": "track",
"whitelist": True,
"whitelist": False,
"fallback": "fallback genre",
"canonical": False,
"prefer_specific": False,
},
"original unknown",
"Jazz",
{
"track": None,
"album": None,
"artist": None,
},
("original unknown", "original fallback"),
("fallback genre", "fallback"),
),
# 8 - fallback to fallback if no original
(
@ -381,6 +381,26 @@ class LastGenrePluginTest(BeetsTestCase):
},
("not ; configured | separator", "keep any, no-force"),
),
# 12 - fallback to next stage (artist) if no allowed original present
# and no album genre were fetched.
(
{
"force": True,
"keep_existing": True,
"source": "album",
"whitelist": True,
"fallback": "fallback genre",
"canonical": False,
"prefer_specific": False,
},
"not whitelisted original",
{
"track": None,
"album": None,
"artist": ["Jazz"],
},
("Jazz", "keep + artist, whitelist"),
),
],
)
def test_get_genre(config_values, item_genre, mock_genres, expected_result):