17 lines
647 B
Python
17 lines
647 B
Python
import pytest
|
|
|
|
|
|
def settings():
|
|
from dx_productivity.dsh.assistant_settings import load_settings, save_settings
|
|
return load_settings, save_settings
|
|
|
|
|
|
def test_settings_are_bounded_persistent_and_do_not_accept_credentials(tmp_path):
|
|
load, save = settings()
|
|
assert load(tmp_path)['response_timeout_seconds'] == 90
|
|
value = save(tmp_path, {'response_timeout_seconds': 120, 'model_context_limit': 12000})
|
|
assert load(tmp_path) == value
|
|
for invalid in [{'response_timeout_seconds': 1}, {'api_key': 'do-not-persist'}, {'model_context_limit': True}]:
|
|
with pytest.raises(ValueError):
|
|
save(tmp_path, invalid)
|