Spaces:
Running
Running
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def test_phase9_migration_is_additive_and_forces_batch_rls() -> None: | |
| migration = ( | |
| ROOT / "app/social/migrations/0009_publishing_operations.sql" | |
| ).read_text() | |
| normalized = migration.lower() | |
| assert "drop table" not in normalized | |
| assert "social_posts add column if not exists revision" in migration | |
| assert "social_schedules add column if not exists revision" in migration | |
| assert "create table if not exists social_publishing_batches" in migration | |
| assert "create table if not exists social_publishing_batch_items" in migration | |
| assert normalized.count("force row level security") >= 2 | |
| assert "current_setting('app.workspace_id'" in migration | |
| def test_phase9_uses_existing_posts_schedules_jobs_and_worker() -> None: | |
| service = ( | |
| ROOT / "app/social/services/publishing_operations_service.py" | |
| ).read_text() | |
| scheduler = (ROOT / "app/social/workers/scheduler.py").read_text() | |
| assert "PostRepository" in service | |
| assert "JobRepository" in service | |
| assert "SchedulingService" in service | |
| assert "process_batch_items" in scheduler | |
| assert "SocialJob(" not in service | |
| def test_phase9_transports_expose_narrow_typed_operations() -> None: | |
| api = (ROOT / "app/api/social.py").read_text() | |
| mcp = (ROOT / "app/mcp/tools/social.py").read_text() | |
| for route in ( | |
| '"/drafts"', | |
| '"/posts/{post_id}/duplicate"', | |
| '"/posts/{post_id}/reschedule"', | |
| '"/calendar"', | |
| '"/queue"', | |
| '"/bulk"', | |
| ): | |
| assert route in api | |
| for tool in ( | |
| "publishing.list_queue", | |
| "publishing.list_calendar", | |
| "publishing.reschedule", | |
| "publishing.duplicate", | |
| "publishing.bulk", | |
| ): | |
| assert tool in mcp | |