Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests for unknown_entities_for_missing=True fix #322

Merged
merged 1 commit into from Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions critiquebrainz/frontend/external/musicbrainz_db/label.py
Expand Up @@ -19,6 +19,7 @@ def get_label_by_id(mbid):
label = db.fetch_multiple_labels(
[mbid],
includes=['artist-rels', 'url-rels'],
unknown_entities_for_missing=True
).get(mbid)
cache.set(key=key, val=label, time=DEFAULT_CACHE_EXPIRATION)
return label_rel.process(label)
Expand Up @@ -35,7 +35,7 @@ def test_artist_cache(self, artist_fetch, cache_set, cache_get):

# Test that first time data is fetched database is queried
cache_get.assert_called_with(expected_key)
artist_fetch.assert_called_with([mbid], includes=['artist-rels', 'url-rels'])
artist_fetch.assert_called_with([mbid], includes=['artist-rels', 'url-rels'], unknown_entities_for_missing=True)
cache_set.assert_called_with(key=expected_key, val=artist, time=DEFAULT_CACHE_EXPIRATION)

cache_get.return_value = artist
Expand Down Expand Up @@ -66,7 +66,8 @@ def test_event_cache(self, event_fetch, cache_set, cache_get):
# Test that first time data is fetched database is queried
cache_get.assert_called_with(expected_key)
event_fetch.assert_called_with([mbid], includes=['artist-rels', 'place-rels',
'series-rels', 'url-rels', 'release-group-rels'])
'series-rels', 'url-rels', 'release-group-rels'],
unknown_entities_for_missing=True)
cache_set.assert_called_with(key=expected_key, val=event, time=DEFAULT_CACHE_EXPIRATION)

cache_get.return_value = event
Expand Down Expand Up @@ -98,7 +99,7 @@ def test_label_cache(self, label_fetch, cache_set, cache_get):

# Test that first time data is fetched database is queried
cache_get.assert_called_with(expected_key)
label_fetch.assert_called_with([mbid], includes=['artist-rels', 'url-rels'])
label_fetch.assert_called_with([mbid], includes=['artist-rels', 'url-rels'], unknown_entities_for_missing=True)
cache_set.assert_called_with(key=expected_key, val=label, time=DEFAULT_CACHE_EXPIRATION)

cache_get.return_value = label
Expand Down Expand Up @@ -137,7 +138,8 @@ def test_place_cache(self, place_fetch, cache_set, cache_get):
# Test that first time data is fetched database is queried
cache_get.assert_called_with(expected_key)
place_fetch.assert_called_with([mbid], includes=['artist-rels', 'place-rels',
'release-group-rels', 'url-rels'])
'release-group-rels', 'url-rels'],
unknown_entities_for_missing=True)
cache_set.assert_called_with(key=expected_key, val=place, time=DEFAULT_CACHE_EXPIRATION)

cache_get.return_value = place
Expand Down Expand Up @@ -178,7 +180,7 @@ def test_release_cache(self, release_fetch, cache_set, cache_get):

# Test that first time data is fetched database is queried
cache_get.assert_called_with(expected_key)
release_fetch.assert_called_with([mbid], includes=['media', 'release-groups'])
release_fetch.assert_called_with([mbid], includes=['media', 'release-groups'], unknown_entities_for_missing=True)
cache_set.assert_called_with(key=expected_key, val=release, time=DEFAULT_CACHE_EXPIRATION)

cache_get.return_value = release
Expand Down Expand Up @@ -219,7 +221,8 @@ def test_release_group_cache(self, release_group_fetch, cache_set, cache_get):
# Test that first time data is fetched database is queried
cache_get.assert_called_with(expected_key)
release_group_fetch.assert_called_with([mbid], includes=['artists', 'releases',
'release-group-rels', 'url-rels', 'tags'])
'release-group-rels', 'url-rels', 'tags'],
unknown_entities_for_missing=True)
cache_set.assert_called_with(key=expected_key, val=release_group, time=DEFAULT_CACHE_EXPIRATION)

cache_get.return_value = release_group
Expand Down