Skip to content

Commit

Permalink
Fix indentation and check includes
Browse files Browse the repository at this point in the history
  • Loading branch information
ferbncode committed Aug 17, 2017
1 parent f89e659 commit 34eccb2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion critiquebrainz/frontend/external/musicbrainz_db/artist.py
Expand Up @@ -6,6 +6,7 @@
from critiquebrainz.frontend.external.relationships import artist as artist_rel
from critiquebrainz.frontend.external.musicbrainz_db.utils import get_entities_by_gids
from critiquebrainz.frontend.external.musicbrainz_db.serialize import to_dict_artists
from critiquebrainz.frontend.external.musicbrainz_db.includes import check_includes
from brainzutils import cache


Expand Down Expand Up @@ -45,7 +46,7 @@ def fetch_multiple_artists(mbids, *, includes=None):
if includes is None:
includes = []
includes_data = defaultdict(dict)
# TODO(ferbncode): Check includes
check_includes('artist', includes)
with mb_session() as db:
query = db.query(models.Artist).\
options(joinedload("type"))
Expand Down
3 changes: 2 additions & 1 deletion critiquebrainz/frontend/external/musicbrainz_db/includes.py
Expand Up @@ -23,7 +23,8 @@
'release_group': ["artists", "media", "releases"] + TAG_INCLUDES + RELATION_INCLUDES,
'release': [
"artists", "labels", "recordings", "release-groups", "media", "annotation", "aliases"
] + TAG_INCLUDES + RELATION_INCLUDES
] + TAG_INCLUDES + RELATION_INCLUDES,
'artist': ["recordings", "releases", "media", "aliases", "annotation"] + RELATION_INCLUDES + TAG_INCLUDES,
}


Expand Down
Expand Up @@ -7,14 +7,12 @@

class ArtistTestCase(TestCase):


def setUp(self):
setup_cache()
mb_artist.mb_session = MagicMock()
self.mock_db = mb_artist.mb_session.return_value.__enter__.return_value
self.artist_query = self.mock_db.query.return_value.options.return_value.filter.return_value.all


def test_get_by_id(self):
self.artist_query.return_value = [artist_linkin_park]
artist = mb_artist.get_artist_by_id("f59c5520-5f46-4d2c-b2c4-822eabf53419")
Expand All @@ -25,7 +23,6 @@ def test_get_by_id(self):
"type": "Group"
})


def test_fetch_multiple_artists(self):
self.artist_query.return_value = [artist_jay_z, artist_linkin_park]
artists = mb_artist.fetch_multiple_artists([
Expand Down

0 comments on commit 34eccb2

Please sign in to comment.