This test suite provides comprehensive coverage of the AI Doc Read Studio application, focusing on recent changes and core functionality.
- test_imports.py - Tests module imports and fixes for recent import path changes
- test_basic_api.py - Tests basic API functionality including uploads, sessions, and endpoints
- test_cache_control.py - Tests cache-busting features and version endpoint
- test_logging.py - Tests structlog integration and cost tracking functionality
- test_agents.py - Tests agent functionality and model mapping
- test_api.py - Additional API tests
- test_document_parser.py - Document parsing functionality
- test_integration.py - Integration tests
- test_strands_agents.py - Strands Agents integration with Amazon Bedrock
- Fixed relative imports to use absolute backend paths
- All modules now properly import without circular dependencies
- Tests:
test_imports.py
- Added cache control headers to all API responses
- Implemented version endpoint for frontend cache detection
- Enhanced frontend with automatic update notifications
- Tests:
test_cache_control.py
- Fixed Logger.log() error by migrating to structlog
- All backend modules now use structured logging
- Cost tracking properly logs with keyword arguments
- Tests:
test_logging.py
- Basic endpoints working correctly
- File upload with size and type validation
- Session creation and management
- Agent templates endpoint
- Tests:
test_basic_api.py
uv run pytest tests/ -v# Test recent changes
uv run pytest tests/test_imports.py tests/test_cache_control.py tests/test_logging.py -v
# Test basic API functionality
uv run pytest tests/test_basic_api.py -v
# Quick smoke test
uv run pytest tests/test_imports.py -v# Run all tests
python run_tests.py
# Run specific test file
python run_tests.py test_basic_api✅ 22 tests passing
❌ 0 failures
- Pydantic V1 to V2 Migration: Update validators to use
@field_validator - PyPDF2 Deprecation: Migrate to
pypdflibrary - datetime.utcnow() Deprecation: Use timezone-aware datetime objects
The test suite covers:
- ✅ Module imports and dependency resolution
- ✅ API endpoint functionality
- ✅ File upload and validation
- ✅ Session management
- ✅ Cache control headers
- ✅ Version endpoint for updates
- ✅ Cost tracking and logging
- ✅ Error handling
- ✅ Basic integration flows
Tests use:
- FastAPI TestClient for API testing
- pytest-asyncio for async test support
- Structured logging verification
- Mock objects where appropriate
- Temporary test data cleanup
- Tests run against the actual backend API using TestClient
- No external services required for basic test suite
- AWS credentials not needed for core functionality tests
- All tests are designed to be independent and can run in any order