13 lines
652 B
Python
13 lines
652 B
Python
from dx_productivity.dsh.provider_config import load_provider, save_provider
|
|
|
|
|
|
def test_provider_key_is_encrypted_and_models_survive_reload(tmp_path):
|
|
key = 'test-credential-not-a-real-key'
|
|
save_provider(tmp_path, base_url='https://example.test/v1/', models=['a', 'b'], default_model='b', api_key=key)
|
|
assert key not in (tmp_path / 'provider.json').read_text(encoding='utf8')
|
|
assert key.encode() not in (tmp_path / 'provider-key.dpapi').read_bytes()
|
|
restored = load_provider(tmp_path)
|
|
assert restored['DSH_API_KEY'] == key
|
|
assert restored['DSH_MODEL'] == 'b'
|
|
assert restored['DSH_API_BASE'] == 'https://example.test/v1'
|