Files
StarPunk/tests/conftest.py
Phil Skentelbery dd822a35b5 feat: v1.2.0-rc.1 - IndieWeb Features Release Candidate
Complete implementation of v1.2.0 "IndieWeb Features" release.

## Phase 1: Custom Slugs
- Optional custom slug field in note creation form
- Auto-sanitization (lowercase, hyphens only)
- Uniqueness validation with auto-numbering
- Read-only after creation to preserve permalinks
- Matches Micropub mp-slug behavior

## Phase 2: Author Discovery + Microformats2
- Automatic h-card discovery from IndieAuth identity URL
- 24-hour caching with graceful fallback
- Never blocks login (per ADR-061)
- Complete h-entry, h-card, h-feed markup
- All required Microformats2 properties
- rel-me links for identity verification
- Passes IndieWeb validation

## Phase 3: Media Upload
- Upload up to 4 images per note (JPEG, PNG, GIF, WebP)
- Automatic optimization with Pillow
  - Auto-resize to 2048px
  - EXIF orientation correction
  - 95% quality compression
- Social media-style layout (media top, text below)
- Optional captions for accessibility
- Integration with all feed formats (RSS, ATOM, JSON Feed)
- Date-organized storage with UUID filenames
- Immutable caching (1 year)

## Database Changes
- migrations/006_add_author_profile.sql - Author discovery cache
- migrations/007_add_media_support.sql - Media storage

## New Modules
- starpunk/author_discovery.py - h-card discovery and caching
- starpunk/media.py - Image upload, validation, optimization

## Documentation
- 4 new ADRs (056, 057, 058, 061)
- Complete design specifications
- Developer Q&A with 40+ questions answered
- 3 implementation reports
- 3 architect reviews (all approved)

## Testing
- 56 new tests for v1.2.0 features
- 842 total tests in suite
- All v1.2.0 feature tests passing

## Dependencies
- Added: mf2py (Microformats2 parser)
- Added: Pillow (image processing)

Version: 1.2.0-rc.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:02:20 -07:00

67 lines
1.4 KiB
Python

"""
Pytest configuration and fixtures for StarPunk tests
"""
import pytest
import tempfile
from pathlib import Path
from starpunk import create_app
@pytest.fixture
def app():
"""Create test Flask application"""
# Create temporary directory for test data
temp_dir = tempfile.mkdtemp()
temp_path = Path(temp_dir)
# Test configuration
config = {
"TESTING": True,
"DEBUG": False,
"DATA_PATH": temp_path,
"NOTES_PATH": temp_path / "notes",
"DATABASE_PATH": temp_path / "test.db",
"SESSION_SECRET": "test-secret-key",
"ADMIN_ME": "https://test.example.com",
"SITE_URL": "http://localhost:5000",
}
# Create app with test config
app = create_app(config)
yield app
# Cleanup (optional - temp dir will be cleaned up by OS)
@pytest.fixture
def client(app):
"""Create test client"""
return app.test_client()
@pytest.fixture
def runner(app):
"""Create test CLI runner"""
return app.test_cli_runner()
@pytest.fixture
def data_dir(app):
"""Return test data directory path"""
return app.config['DATA_PATH']
@pytest.fixture
def sample_note(app):
"""Create a single sample note for testing"""
from starpunk.notes import create_note
with app.app_context():
note = create_note(
content="This is a sample note for testing.\n\nIt has multiple paragraphs.",
published=True,
)
return note