Files
intercept/tests/test_config.py
Smittix e00fbfddc1 v2.26.0: fix SSE fanout crash and branded logo FOUC
- Fix SSE fanout thread AttributeError when source queue is None during
  interpreter shutdown by snapshotting to local variable with null guard
- Fix branded "i" logo rendering oversized on first page load (FOUC) by
  adding inline width/height to SVG elements across 10 templates
- Bump version to 2.26.0 in config.py, pyproject.toml, and CHANGELOG.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:51:27 +00:00

49 lines
1.3 KiB
Python

"""Tests for configuration module."""
class TestConfigEnvVars:
"""Tests for environment variable configuration."""
def test_default_values(self):
"""Test that default values are set."""
from config import DEBUG, HOST, PORT
assert PORT == 5050
assert HOST == '0.0.0.0'
assert DEBUG is False
def test_env_override(self, monkeypatch):
"""Test that environment variables override defaults."""
monkeypatch.setenv('INTERCEPT_PORT', '8080')
monkeypatch.setenv('INTERCEPT_DEBUG', 'true')
# Re-import to get new values
import importlib
import config
importlib.reload(config)
assert config.PORT == 8080
assert config.DEBUG is True
# Reset
monkeypatch.delenv('INTERCEPT_PORT', raising=False)
monkeypatch.delenv('INTERCEPT_DEBUG', raising=False)
importlib.reload(config)
def test_invalid_env_values(self, monkeypatch):
"""Test that invalid env values fall back to defaults."""
monkeypatch.setenv('INTERCEPT_PORT', 'invalid')
import importlib
import config
importlib.reload(config)
# Should fall back to default
assert config.PORT == 5050
monkeypatch.delenv('INTERCEPT_PORT', raising=False)
importlib.reload(config)