Skip to content

Commit

Permalink
fix musicbrainz tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aw-was-here committed Sep 8, 2024
1 parent 9fe8577 commit 3fdb9b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion nowplaying/musicbrainz.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ def _check_not_allow_others():
if not mbdata.get('recording-list'):
return riddata

newlist = sorted(mbdata['recording-list'],
key=lambda d: d.get('first-release-date', '9999-99-99'))
variousartistrid = None
for recording in mbdata['recording-list']:
#logging.debug(newlist)
for recording in newlist:
rid = recording['id']
logging.debug('recording id = %s', rid)
if not recording.get('release-list'):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_musicbrainz.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_fallback_prince_compblue_purplerain(getmusicbrainz): # pylint: disable
#
metadata = {'artist': 'Prince', 'title': 'Computer Blue', 'album': 'Purple Rain'}
newdata = mbhelper.lastditcheffort(metadata)
assert not newdata.get('musicbrainzartistid')
assert not newdata


def test_fallback_princeandther_compblue_purplerain(getmusicbrainz): # pylint: disable=redefined-outer-name
Expand Down Expand Up @@ -193,7 +193,8 @@ def test_fallback_queen(getmusicbrainz): # pylint: disable=redefined-outer-name
metadata = {'artist': 'Queen', 'title': 'We Will Rock You'}
newdata = mbhelper.lastditcheffort(metadata)
assert newdata['musicbrainzartistid'] == ['0383dadf-2a4e-4d10-a46a-e9e041da8eb3']
assert newdata['album'] == 'News of the World'
assert newdata['album'] in ['News of the World',
'Crazy Little Thing Called Love'] # can pull album or a single


def test_fallback_grimesfeatjanelle(getmusicbrainz): # pylint: disable=redefined-outer-name
Expand Down

0 comments on commit 3fdb9b4

Please sign in to comment.