fix(identity): share one model-download user agent definition
Both model-download call sites built the User-Agent string separately: recognition_manager used a hardcoded literal while settings_dialog interpolated APP_ID. Add app_identity.user_agent() and use it in both, with a test pinning the shared definition. Fixes #17
This commit is contained in:
@@ -117,6 +117,20 @@ def test_source_pinned_literals_reserved_for_rename():
|
||||
assert 'window.set_title("Voculinux Dictation Pad")' in pad
|
||||
|
||||
|
||||
def test_model_download_user_agent_is_shared_definition():
|
||||
"""Model-download User-Agent strings resolve through one shared helper."""
|
||||
identity = _load_identity()
|
||||
assert identity.user_agent("9.9.9") == f"{identity.APP_ID}/9.9.9"
|
||||
for rel in (
|
||||
SRC_ROOT / "speech_recognition" / "recognition_manager.py",
|
||||
SRC_ROOT / "ui" / "settings_dialog.py",
|
||||
):
|
||||
source = rel.read_text(encoding="utf-8")
|
||||
assert "user_agent(__version__)" in source, rel
|
||||
assert 'f"voculinux/{__version__}"' not in source, rel
|
||||
assert 'f"{APP_ID}/{__version__}"' not in source, rel
|
||||
|
||||
|
||||
def test_rename_inventory_files_exist():
|
||||
"""Every rename surface the rename ticket must flip is a real checked file."""
|
||||
identity = _load_identity()
|
||||
|
||||
Reference in New Issue
Block a user