v2.14.0 (#743)
Co-authored-by: Alexis Tacnet <alexis@mistral.ai> Co-authored-by: Clément Drouin <clement.drouin@mistral.ai> Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Lucas Marandat <31749711+lucasmrdt@users.noreply.github.com> Co-authored-by: Maxime Dolores <maxime.dolores@ext.mistral.ai> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Quentin <quentin.torroba@mistral.ai> Co-authored-by: Val <102326092+vdeva@users.noreply.github.com> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: p.vezia <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Hiba Chaabnia <Hiba-Chaabnia@users.noreply.github.com> Co-authored-by: Nikhil Bhima <nikhilbhima@users.noreply.github.com> Co-authored-by: Nkipohcs <Nkipohcs@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
ad0d5c9520
commit
3f8487f761
197 changed files with 10819 additions and 2830 deletions
48
tests/core/test_environment_layer.py
Normal file
48
tests/core/test_environment_layer.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from vibe.core.config.layers.environment import EnvironmentLayer
|
||||
from vibe.core.config.vibe_schema import VibeConfigSchema
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_reads_env_vars() -> None:
|
||||
env = {
|
||||
"MISTRAL_API_KEY": "test-key",
|
||||
"VIBE_ACTIVE_MODEL": "mistral-large",
|
||||
"VIBE_VIM_KEYBINDINGS": "true",
|
||||
"VIBE_ENABLE_TELEMETRY": "0",
|
||||
"VIBE_UNKNOWN_VAR": "ignored",
|
||||
"VIBE_SESSION_LOGGING__ENABLED": "false",
|
||||
"VIBE_SESSION_LOGGING__SESSION_PREFIX": "mysession",
|
||||
"VIBE_API_TIMEOUT": ".12",
|
||||
}
|
||||
with patch.dict(os.environ, env, clear=True):
|
||||
layer = EnvironmentLayer(schema=VibeConfigSchema)
|
||||
data = await layer.load()
|
||||
|
||||
assert data.model_dump() == {
|
||||
"active_model": "mistral-large",
|
||||
"vim_keybindings": True,
|
||||
"enable_telemetry": False,
|
||||
"session_logging": {"enabled": False, "session_prefix": "mysession"},
|
||||
"api_timeout": 0.12,
|
||||
}
|
||||
|
||||
assert layer.name == "environment"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_no_vars_set_returns_empty() -> None:
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
data = await EnvironmentLayer(schema=VibeConfigSchema).load()
|
||||
assert data.model_dump() == {}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_always_trusted() -> None:
|
||||
assert await EnvironmentLayer(schema=VibeConfigSchema).resolve_trust() is True
|
||||
Loading…
Add table
Add a link
Reference in a new issue