Remove ai.enabled configuration support
This commit is contained in:
parent
ccf968a410
commit
2c570c7a87
5 changed files with 22 additions and 26 deletions
|
|
@ -26,7 +26,6 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertEqual(cfg.stt.device, "cpu")
|
||||
self.assertEqual(cfg.injection.backend, "clipboard")
|
||||
self.assertFalse(cfg.injection.remove_transcription_from_clipboard)
|
||||
self.assertTrue(cfg.ai.enabled)
|
||||
self.assertEqual(cfg.vocabulary.replacements, [])
|
||||
self.assertEqual(cfg.vocabulary.terms, [])
|
||||
self.assertEqual(cfg.vocabulary.max_rules, 500)
|
||||
|
|
@ -43,7 +42,6 @@ class ConfigTests(unittest.TestCase):
|
|||
"backend": "injection",
|
||||
"remove_transcription_from_clipboard": True,
|
||||
},
|
||||
"ai": {"enabled": False},
|
||||
"vocabulary": {
|
||||
"replacements": [
|
||||
{"from": "Martha", "to": "Marta"},
|
||||
|
|
@ -67,7 +65,6 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertEqual(cfg.stt.device, "cuda")
|
||||
self.assertEqual(cfg.injection.backend, "injection")
|
||||
self.assertTrue(cfg.injection.remove_transcription_from_clipboard)
|
||||
self.assertFalse(cfg.ai.enabled)
|
||||
self.assertEqual(cfg.vocabulary.max_rules, 100)
|
||||
self.assertEqual(cfg.vocabulary.max_terms, 200)
|
||||
self.assertEqual(len(cfg.vocabulary.replacements), 2)
|
||||
|
|
@ -84,7 +81,6 @@ class ConfigTests(unittest.TestCase):
|
|||
"whisper_model": "tiny",
|
||||
"whisper_device": "cpu",
|
||||
"injection_backend": "clipboard",
|
||||
"ai_enabled": False,
|
||||
}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
|
|
@ -98,7 +94,6 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertEqual(cfg.stt.device, "cpu")
|
||||
self.assertEqual(cfg.injection.backend, "clipboard")
|
||||
self.assertFalse(cfg.injection.remove_transcription_from_clipboard)
|
||||
self.assertFalse(cfg.ai.enabled)
|
||||
self.assertEqual(cfg.vocabulary.replacements, [])
|
||||
|
||||
def test_invalid_injection_backend_raises(self):
|
||||
|
|
@ -119,6 +114,24 @@ class ConfigTests(unittest.TestCase):
|
|||
with self.assertRaisesRegex(ValueError, "injection.remove_transcription_from_clipboard"):
|
||||
load(str(path))
|
||||
|
||||
def test_removed_ai_section_raises(self):
|
||||
payload = {"ai": {"enabled": True}}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "ai section is no longer supported"):
|
||||
load(str(path))
|
||||
|
||||
def test_removed_legacy_ai_enabled_raises(self):
|
||||
payload = {"ai_enabled": True}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "ai_enabled is no longer supported"):
|
||||
load(str(path))
|
||||
|
||||
def test_removed_logging_section_raises(self):
|
||||
payload = {"logging": {"log_transcript": True}}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ class FakeAudio:
|
|||
class DaemonTests(unittest.TestCase):
|
||||
def _config(self) -> Config:
|
||||
cfg = Config()
|
||||
cfg.ai.enabled = False
|
||||
return cfg
|
||||
|
||||
@patch("leld.stop_audio_recording", return_value=FakeAudio(8))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue