| 12345678910111213141516171819202122232425 |
- import pytest
- from pydantic import ValidationError
- from zhifu.core.config import Settings
- def test_state_and_cache_require_separate_services():
- with pytest.raises(ValidationError, match="独立 Redis"):
- Settings(
- _env_file=None,
- database_url="mysql+asyncmy://user:password@localhost/database",
- cache_url="redis://localhost:6379/0",
- state_url="redis://localhost:6379/1",
- )
- def test_production_rejects_development_credentials():
- with pytest.raises(ValidationError, match="独立凭据"):
- Settings(
- _env_file=None,
- environment="production",
- database_url="mysql+asyncmy://user:zhifu_local_only@localhost/database",
- cache_url="redis://localhost:6379/0",
- state_url="redis://localhost:6380/0",
- )
|