Fix MB-worker alias test fixtures missing self.db
The #799 uniqueness-guard added a source_id_conflict(self.db, ...) call to the MusicBrainz worker's artist path. Two TestWorkerAliasEnrichment fixtures build the worker via __new__ and set only .database, not .db, so the new call raised AttributeError and the artist was marked 'error'. Mirror the third fixture (which already sets worker.db). Production always sets self.db in __init__ — test-only gap exposed by the new code path.
This commit is contained in:
parent
e7a50159e8
commit
ad1bd97aac
1 changed files with 3 additions and 0 deletions
|
|
@ -270,6 +270,7 @@ class TestWorkerAliasEnrichment:
|
|||
|
||||
worker = MusicBrainzWorker.__new__(MusicBrainzWorker)
|
||||
worker.database = temp_db
|
||||
worker.db = temp_db # worker code uses self.db (e.g. source_id_conflict)
|
||||
worker.mb_service = MagicMock()
|
||||
worker.mb_service.match_artist.return_value = {
|
||||
'mbid': '60d2ea34-1912-425f-bf9c-fc544e4448cd', 'name': 'Hiroyuki Sawano',
|
||||
|
|
@ -300,6 +301,7 @@ class TestWorkerAliasEnrichment:
|
|||
|
||||
worker = MusicBrainzWorker.__new__(MusicBrainzWorker)
|
||||
worker.database = temp_db
|
||||
worker.db = temp_db # worker code uses self.db (e.g. source_id_conflict)
|
||||
worker.mb_service = MagicMock()
|
||||
worker.mb_service.match_artist.return_value = None
|
||||
worker.stats = {'matched': 0, 'not_found': 0, 'errors': 0}
|
||||
|
|
@ -392,6 +394,7 @@ class TestWorkerAliasEnrichment:
|
|||
|
||||
worker = MusicBrainzWorker.__new__(MusicBrainzWorker)
|
||||
worker.database = temp_db
|
||||
worker.db = temp_db # worker code uses self.db (e.g. source_id_conflict)
|
||||
worker.mb_service = MagicMock()
|
||||
worker.mb_service.match_artist.return_value = {'mbid': 'mb-x', 'name': 'X'}
|
||||
worker.mb_service.fetch_artist_aliases.side_effect = Exception("boom")
|
||||
|
|
|
|||
Loading…
Reference in a new issue