- Add requirements.txt with all core dependencies: - FastAPI 0.104.1, uvicorn 0.24.0 - SQLAlchemy 2.0.23, Alembic 1.12.1 - Pydantic 2.5.0, pydantic-settings 2.1.0 - python-jose 3.3.0, passlib 1.7.4, cryptography 41.0.7 - httpx 0.25.2, pytest 7.4.3, pytest-asyncio 0.21.1, pytest-cov 4.1.0 - Add test_requirements.py with 15 unit tests - All tests passing (15/15) Refs: T03
113 lines
5.5 KiB
Python
113 lines
5.5 KiB
Python
"""Test for requirements.txt setup (T03)."""
|
|
import os
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.unit
|
|
class TestRequirementsSetup:
|
|
"""Test requirements.txt contains all necessary dependencies."""
|
|
|
|
def test_requirements_txt_exists(self):
|
|
"""Verify requirements.txt file exists."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
assert os.path.isfile(req_path), f"File {req_path} does not exist"
|
|
|
|
def test_requirements_contains_fastapi(self):
|
|
"""Verify FastAPI is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'fastapi' in content, "requirements.txt should contain FastAPI"
|
|
|
|
def test_requirements_contains_uvicorn(self):
|
|
"""Verify uvicorn is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'uvicorn' in content, "requirements.txt should contain uvicorn"
|
|
|
|
def test_requirements_contains_sqlalchemy(self):
|
|
"""Verify SQLAlchemy is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'sqlalchemy' in content, "requirements.txt should contain SQLAlchemy"
|
|
|
|
def test_requirements_contains_alembic(self):
|
|
"""Verify Alembic is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'alembic' in content, "requirements.txt should contain Alembic"
|
|
|
|
def test_requirements_contains_pydantic(self):
|
|
"""Verify Pydantic is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'pydantic' in content, "requirements.txt should contain Pydantic"
|
|
|
|
def test_requirements_contains_pydantic_settings(self):
|
|
"""Verify pydantic-settings is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'pydantic-settings' in content, "requirements.txt should contain pydantic-settings"
|
|
|
|
def test_requirements_contains_python_jose(self):
|
|
"""Verify python-jose is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'python-jose' in content, "requirements.txt should contain python-jose"
|
|
|
|
def test_requirements_contains_passlib(self):
|
|
"""Verify passlib is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'passlib' in content, "requirements.txt should contain passlib"
|
|
|
|
def test_requirements_contains_cryptography(self):
|
|
"""Verify cryptography is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'cryptography' in content, "requirements.txt should contain cryptography"
|
|
|
|
def test_requirements_contains_httpx(self):
|
|
"""Verify httpx is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'httpx' in content, "requirements.txt should contain httpx"
|
|
|
|
def test_requirements_contains_pytest(self):
|
|
"""Verify pytest is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'pytest' in content, "requirements.txt should contain pytest"
|
|
|
|
def test_requirements_contains_pytest_asyncio(self):
|
|
"""Verify pytest-asyncio is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'pytest-asyncio' in content, "requirements.txt should contain pytest-asyncio"
|
|
|
|
def test_requirements_contains_pytest_cov(self):
|
|
"""Verify pytest-cov is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'pytest-cov' in content or 'pytest-coverage' in content, \
|
|
"requirements.txt should contain pytest-cov"
|
|
|
|
def test_requirements_contains_python_multipart(self):
|
|
"""Verify python-multipart is in requirements."""
|
|
req_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/requirements.txt"
|
|
with open(req_path, 'r') as f:
|
|
content = f.read().lower()
|
|
assert 'python-multipart' in content, "requirements.txt should contain python-multipart"
|