Spaces:
Sleeping
Sleeping
Download tests/test_database_pool.py from baljot07/studiq-backend: direct link, hf CLI and curl.
- Browser
- Download file 638 Bytes
-
https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/tests/test_database_pool.py
- Command line
-
hf download hf://spaces/baljot07/studiq-backend/tests/test_database_pool.py
-
curl -L -o test_database_pool.py https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/tests/test_database_pool.py
638 Bytes
| """Unit tests for database session generation and URL construction.""" | |
| import pytest | |
| from app.database import _build_url, get_db | |
| def test_build_url_asyncpg_replacement(): | |
| """Ensure standard postgresql:// prefixes are converted to postgresql+asyncpg://.""" | |
| standard_url = "postgresql://user:pass@localhost:5432/studiq" | |
| async_url = _build_url(standard_url) | |
| assert async_url == "postgresql+asyncpg://user:pass@localhost:5432/studiq" | |
| def test_build_url_sqlite_passthrough(): | |
| """Ensure sqlite:// urls remain unchanged.""" | |
| sqlite_url = "sqlite+aiosqlite:///:memory:" | |
| assert _build_url(sqlite_url) == sqlite_url | |