Files
newz-qwen-9b/backend/tests/test_version.py
T

41 lines
1013 B
Python

"""
Test version endpoint behavior.
"""
import pytest
from fastapi.testclient import TestClient
@pytest.fixture
def client():
"""Create test client."""
from main import app
return TestClient(app)
class TestVersionEndpoint:
"""Tests for the /api/v1/version endpoint."""
def test_version_endpoint_exists(self, client):
"""Test that version endpoint exists and is accessible."""
response = client.get("/api/v1/version")
assert response.status_code == 200
def test_version_format(self, client):
"""Test version returns valid version string."""
response = client.get("/api/v1/version")
data = response.json()
# Check structure
assert "version" in data
assert "application" in data
# Check version format (vX.Y.Z)
version = data["version"]
assert isinstance(version, str)
assert version.startswith("v")
if __name__ == "__main__":
pytest.main([__file__, "-v"])