mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-05-04 22:30:38 +00:00
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
"""Tests for config/settings.py"""
|
|
|
|
import pytest
|
|
import os
|
|
|
|
|
|
class TestSettings:
|
|
"""Test Settings configuration."""
|
|
|
|
def test_settings_loads(self):
|
|
"""Ensure Settings can be instantiated."""
|
|
from config.settings import Settings
|
|
|
|
settings = Settings()
|
|
assert settings is not None
|
|
|
|
def test_default_values(self):
|
|
"""Test default values are set and have correct types."""
|
|
from config.settings import Settings
|
|
|
|
settings = Settings()
|
|
assert isinstance(settings.nvidia_nim_rate_limit, int)
|
|
assert isinstance(settings.nvidia_nim_rate_window, int)
|
|
assert isinstance(settings.fast_prefix_detection, bool)
|
|
assert isinstance(settings.max_cli_sessions, int)
|
|
|
|
def test_get_settings_cached(self):
|
|
"""Test get_settings returns cached instance."""
|
|
from config.settings import get_settings
|
|
|
|
s1 = get_settings()
|
|
s2 = get_settings()
|
|
assert s1 is s2 # Same object (cached)
|
|
|
|
def test_empty_string_to_none_for_optional_int(self):
|
|
"""Test that empty string converts to None for optional int fields."""
|
|
from config.settings import Settings
|
|
|
|
# Settings should handle NVIDIA_NIM_SEED="" gracefully
|
|
settings = Settings()
|
|
assert settings.nvidia_nim_seed is None or isinstance(
|
|
settings.nvidia_nim_seed, int
|
|
)
|
|
|
|
def test_model_setting(self):
|
|
"""Test model setting exists and is a string."""
|
|
from config.settings import Settings
|
|
|
|
settings = Settings()
|
|
assert isinstance(settings.model, str)
|
|
assert len(settings.model) > 0
|
|
|
|
def test_base_url_constant(self):
|
|
"""Test NVIDIA_NIM_BASE_URL is a constant."""
|
|
from config.settings import NVIDIA_NIM_BASE_URL
|
|
|
|
assert NVIDIA_NIM_BASE_URL == "https://integrate.api.nvidia.com/v1"
|