Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
72 lines
2.4 KiB
Python
72 lines
2.4 KiB
Python
"""Unit: stories.contract — template-bound draft + ReelForgeParams fold."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from app.domains.stories.contract import (
|
|
DEFAULT_MAX_WORDS,
|
|
MINECRAFT_SLUG,
|
|
build_story_reel_draft,
|
|
story_params,
|
|
)
|
|
from app.domains.templates.validation import TemplateError
|
|
from app.services.reelforge import ReelForgeParams
|
|
|
|
_SCRIPT = "Something wild happened. Then it got worse. Comment if you want Part 2."
|
|
|
|
|
|
def test_constants():
|
|
assert MINECRAFT_SLUG == "minecraft-reddit-split"
|
|
assert DEFAULT_MAX_WORDS == 130
|
|
|
|
|
|
def test_build_story_reel_draft_shape():
|
|
draft = build_story_reel_draft(_SCRIPT, subject="AITA roommate")
|
|
assert draft["layout"] == "split"
|
|
assert draft["caption_style"] == "karaoke_yellow"
|
|
# The flagship minecraft loop is pinned (not the compiler's stock fallback).
|
|
assert draft["background_id"] == "voxel-parkour"
|
|
assert draft["video_script"] == _SCRIPT
|
|
assert draft["video_subject"] == "AITA roommate"
|
|
# No gameplay clip supplied — the split preset auto-fills the background.
|
|
assert "screen_recording_key" not in draft
|
|
|
|
|
|
def test_build_story_reel_draft_folds_voice_and_aspect():
|
|
draft = build_story_reel_draft(_SCRIPT, subject="x", voice_id="rachel", aspect="9:16")
|
|
assert draft["voice_name"] == "elevenlabs:rachel"
|
|
assert draft["aspect"] == "9:16"
|
|
|
|
|
|
def test_invalid_story_raises_template_error():
|
|
with pytest.raises(TemplateError):
|
|
build_story_reel_draft("", subject="x")
|
|
|
|
|
|
def test_story_params_defaults_skip_upload():
|
|
params = story_params(_SCRIPT, subject="AITA")
|
|
assert isinstance(params, ReelForgeParams)
|
|
assert params.platforms == () # empty => render chain skips stage_upload
|
|
assert params.layout == "split"
|
|
assert params.caption_style == "karaoke_yellow"
|
|
assert params.background_id == "voxel-parkour"
|
|
assert params.video_script == _SCRIPT
|
|
assert params.voice_name == ""
|
|
|
|
|
|
def test_story_params_voice_mapping():
|
|
params = story_params(_SCRIPT, subject="AITA", voice_id="adam")
|
|
assert params.voice_name == "elevenlabs:adam"
|
|
|
|
|
|
def test_story_params_is_immutable():
|
|
params = story_params(_SCRIPT, subject="AITA")
|
|
with pytest.raises(Exception):
|
|
params.video_script = "mutated" # type: ignore[misc]
|
|
|
|
|
|
def test_story_params_passthrough_platforms():
|
|
params = story_params(_SCRIPT, subject="AITA", platforms=("tiktok",))
|
|
assert params.platforms == ("tiktok",)
|