mirror of
https://github.com/beetbox/beets.git
synced 2026-01-13 19:52:48 +01:00
58 lines
1.5 KiB
Python
58 lines
1.5 KiB
Python
import uuid
|
|
|
|
import pytest
|
|
|
|
from beets.library import Album
|
|
from beets.test.helper import PluginMixin, TestHelper
|
|
|
|
|
|
@pytest.fixture
|
|
def helper():
|
|
helper = TestHelper()
|
|
helper.setup_beets()
|
|
|
|
yield helper
|
|
|
|
helper.teardown_beets()
|
|
|
|
|
|
class TestMissingAlbums(PluginMixin):
|
|
plugin = "missing"
|
|
album_in_lib = Album(
|
|
album="Album",
|
|
albumartist="Artist",
|
|
mb_albumartistid=str(uuid.uuid4()),
|
|
mb_albumid="album",
|
|
)
|
|
|
|
@pytest.mark.parametrize(
|
|
"release_from_mb,expected_output",
|
|
[
|
|
pytest.param(
|
|
{"id": "other", "title": "Other Album"},
|
|
"Artist - Other Album\n",
|
|
id="missing",
|
|
),
|
|
pytest.param(
|
|
{"id": album_in_lib.mb_albumid, "title": album_in_lib.album},
|
|
"",
|
|
marks=pytest.mark.xfail(
|
|
reason="album in lib should not be reported as missing. Needs fixing."
|
|
),
|
|
id="not missing",
|
|
),
|
|
],
|
|
)
|
|
def test_missing_artist_albums(
|
|
self, monkeypatch, helper, release_from_mb, expected_output
|
|
):
|
|
helper.lib.add(self.album_in_lib)
|
|
monkeypatch.setattr(
|
|
"musicbrainzngs.browse_release_groups",
|
|
lambda **__: {"release-group-list": [release_from_mb]},
|
|
)
|
|
|
|
with self.configure_plugin({}):
|
|
assert (
|
|
helper.run_with_output("missing", "--album") == expected_output
|
|
)
|