soulsync/tests/metadata/test_runtime_bundle.py
Antti Kettunen 9b2b6d856f
Split runtime builders into owning modules
- Move the import pipeline runtime factory into core.imports.pipeline
- Move the metadata runtime factory into core.metadata.enrichment
- Keep the web server wiring thin and drop the shared glue module
- Add contract tests that keep the two runtime bundles separate
2026-04-27 19:54:45 +03:00

56 lines
1.8 KiB
Python

import types
from core.imports.pipeline import build_import_pipeline_runtime
from core.metadata.enrichment import build_metadata_enrichment_runtime
def test_build_import_pipeline_runtime_exposes_expected_contract():
import_fields = {
"automation_engine": object(),
"on_download_completed": object(),
"web_scan_manager": object(),
"repair_worker": object(),
}
runtime = build_import_pipeline_runtime(**import_fields)
assert isinstance(runtime, types.SimpleNamespace)
for name, value in import_fields.items():
assert hasattr(runtime, name)
assert getattr(runtime, name) is value
for name in (
"mb_worker",
"deezer_worker",
"audiodb_worker",
"tidal_client",
"qobuz_enrichment_worker",
"lastfm_worker",
"genius_worker",
"spotify_enrichment_worker",
"itunes_enrichment_worker",
):
assert not hasattr(runtime, name)
def test_build_metadata_enrichment_runtime_exposes_expected_contract():
metadata_fields = {
"mb_worker": object(),
"deezer_worker": object(),
"audiodb_worker": object(),
"tidal_client": object(),
"qobuz_enrichment_worker": object(),
"lastfm_worker": object(),
"genius_worker": object(),
"spotify_enrichment_worker": object(),
"itunes_enrichment_worker": object(),
}
runtime = build_metadata_enrichment_runtime(**metadata_fields)
assert isinstance(runtime, types.SimpleNamespace)
for name, value in metadata_fields.items():
assert hasattr(runtime, name)
assert getattr(runtime, name) is value
for name in ("automation_engine", "on_download_completed", "web_scan_manager", "repair_worker"):
assert not hasattr(runtime, name)