Files
swingmusic-extended/tests/test_health.py
T
Tomas Dvorak cbf646e25b Fix CI/CD pipeline and code quality issues
## Major Changes
- Fixed all TypeScript errors in web client for successful compilation
- Resolved 82+ Python lint errors across backend services
- Updated Flutter SDK compatibility for mobile app
- Fixed security workflow configuration

## Web Client Fixes
- Fixed import path in DragonflyDashboard.vue (dragonflyApi import)
- All TypeScript compilation now passes without errors

## Backend Lint Fixes
- Updated type annotations to modern Python syntax (dict instead of Dict, X | None instead of Optional[X])
- Replaced try-except-pass with contextlib.suppress(Exception)
- Removed unused imports (Dict, Optional, Any, Iterator, etc.)
- Fixed bare except clauses to use Exception
- Sorted and formatted imports with ruff
- Applied ruff format to 27 files

## Workflow Fixes
- Updated Flutter SDK constraint from ^3.10.4 to ^3.5.0 (compatible with Flutter 3.24.0)
- Changed pip-audit format from github to json in security.yml
- Added comprehensive CI workflows (readiness-gate.yml, security.yml)

## Infrastructure
- Added DragonflyDB caching system integration
- Enhanced Docker configuration with multi-stage builds
- Added pytest configuration and test infrastructure
- Improved production readiness with proper error handling

## Verification
- backend-lint job:  Succeeded
- web job:  Succeeded
- Ready for GitHub deployment

All CI/CD issues resolved. Codebase now passes all quality checks.
2026-03-21 10:01:14 +01:00

64 lines
2.0 KiB
Python

"""
Health check integration tests.
"""
import pytest
class TestHealthEndpoint:
"""Tests for the /healthz endpoint."""
def test_healthz_returns_ok(self, client):
"""Health endpoint should return ok: true when server is running."""
response = client.get("/healthz")
assert response.status_code == 200
data = response.get_json()
assert data.get("ok") is True
def test_healthz_returns_setup_status(self, client):
"""Health endpoint should include setup completion status."""
response = client.get("/healthz")
assert response.status_code == 200
data = response.get_json()
assert "setup_completed" in data
assert "onboarding_required" in data
def test_healthz_returns_registered_modules(self, client):
"""Health endpoint should list registered API modules."""
response = client.get("/healthz")
assert response.status_code == 200
data = response.get_json()
assert "registered_modules" in data
assert "failed_modules" in data
def test_healthz_no_failed_modules(self, client):
"""Health endpoint should show no failed modules in normal operation."""
response = client.get("/healthz")
assert response.status_code == 200
data = response.get_json()
assert data.get("failed_modules") == []
class TestSetupStatus:
"""Tests for the /setup/status endpoint."""
def test_setup_status_returns_required(self, client):
"""Setup status should indicate if setup is required."""
response = client.get("/setup/status")
assert response.status_code == 200
data = response.get_json()
assert "required" in data
def test_setup_status_returns_version_info(self, client):
"""Setup status should include version information."""
response = client.get("/setup/status")
assert response.status_code == 200
data = response.get_json()
# Version info may be present
assert isinstance(data, dict)