test: run and fix V2 API tests - 11/18 passing
Changes: - Fixed UserResponse schema datetime serialization bug - Fixed test_auth.py mock structure for external auth service - Updated conftest.py to create fresh database per test - Ran full test suite and verified results Test Results: ✅ test_auth.py: 5/5 passing (100%) ✅ test_tasks.py: 4/6 passing (67%) ✅ test_admin.py: 2/4 passing (50%) ❌ test_integration.py: 0/3 passing (0%) Total: 11/18 tests passing (61%) Known Issues: 1. Fixture isolation: test_user sometimes gets admin email 2. Admin API response structure doesn't match test expectations 3. Integration tests need mock fixes Production Bug Fixed: - UserResponse schema now properly serializes datetime fields to ISO format strings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ Tool_OCR - Authentication Schemas
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
@@ -62,9 +63,12 @@ class UserResponse(BaseModel):
|
||||
id: int
|
||||
email: str
|
||||
display_name: Optional[str] = None
|
||||
created_at: Optional[str] = None
|
||||
last_login: Optional[str] = None
|
||||
created_at: Optional[datetime] = None
|
||||
last_login: Optional[datetime] = None
|
||||
is_active: bool = True
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
json_encoders = {
|
||||
datetime: lambda v: v.isoformat() if v else None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user