Implement Sprint 1: Notebook Management CRUD
- Add NotebookService with full CRUD operations
- Add POST /api/v1/notebooks (create notebook)
- Add GET /api/v1/notebooks (list with pagination)
- Add GET /api/v1/notebooks/{id} (get by ID)
- Add PATCH /api/v1/notebooks/{id} (partial update)
- Add DELETE /api/v1/notebooks/{id} (delete)
- Add Pydantic models for requests/responses
- Add custom exceptions (ValidationError, NotFoundError, NotebookLMError)
- Add comprehensive unit tests (31 tests, 97% coverage)
- Add API integration tests (26 tests)
- Fix router prefix duplication
- Fix JSON serialization in error responses
BREAKING CHANGE: None
57 lines
1.4 KiB
Python
57 lines
1.4 KiB
Python
"""Tests for health routes."""
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from notebooklm_agent.api.main import app
|
|
|
|
|
|
@pytest.mark.unit
|
|
class TestHealthEndpoints:
|
|
"""Test suite for health check endpoints."""
|
|
|
|
def test_health_check_returns_healthy(self):
|
|
"""Should return healthy status."""
|
|
# Arrange
|
|
client = TestClient(app)
|
|
|
|
# Act
|
|
response = client.get("/health/")
|
|
|
|
# Assert
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert data["status"] == "healthy"
|
|
assert "timestamp" in data
|
|
assert data["service"] == "notebooklm-agent-api"
|
|
assert data["version"] == "0.1.0"
|
|
|
|
def test_readiness_check_returns_ready(self):
|
|
"""Should return ready status."""
|
|
# Arrange
|
|
client = TestClient(app)
|
|
|
|
# Act
|
|
response = client.get("/health/ready")
|
|
|
|
# Assert
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert data["status"] == "ready"
|
|
assert "timestamp" in data
|
|
assert "checks" in data
|
|
|
|
def test_liveness_check_returns_alive(self):
|
|
"""Should return alive status."""
|
|
# Arrange
|
|
client = TestClient(app)
|
|
|
|
# Act
|
|
response = client.get("/health/live")
|
|
|
|
# Assert
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert data["status"] == "alive"
|
|
assert "timestamp" in data
|