84 lines
2.7 KiB
Python
84 lines
2.7 KiB
Python
import os
|
|
import tempfile
|
|
from datetime import datetime
|
|
|
|
|
|
def test_save_transcript_creates_file():
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
from output import save_transcript
|
|
path = save_transcript(
|
|
title="Test Aufnahme",
|
|
content="Dies ist ein Test.",
|
|
output_dir=tmpdir,
|
|
dt=datetime(2026, 4, 1, 14, 32, 0),
|
|
)
|
|
assert os.path.exists(path)
|
|
|
|
|
|
def test_save_transcript_filename_format():
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
from output import save_transcript
|
|
path = save_transcript(
|
|
title="Mein erstes Diktat",
|
|
content="Inhalt.",
|
|
output_dir=tmpdir,
|
|
dt=datetime(2026, 4, 1, 14, 32, 0),
|
|
)
|
|
assert os.path.basename(path) == "2026-04-01-1432-mein-erstes-diktat.md"
|
|
|
|
|
|
def test_save_transcript_contains_frontmatter():
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
from output import save_transcript
|
|
path = save_transcript(
|
|
title="Test",
|
|
content="Inhalt.",
|
|
output_dir=tmpdir,
|
|
dt=datetime(2026, 4, 1, 14, 32, 0),
|
|
)
|
|
text = open(path).read()
|
|
assert "---" in text
|
|
assert "date:" in text
|
|
assert "transkript" in text
|
|
|
|
|
|
def test_save_transcript_contains_content():
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
from output import save_transcript
|
|
path = save_transcript(
|
|
title="Test",
|
|
content="Das ist der Inhalt.",
|
|
output_dir=tmpdir,
|
|
dt=datetime(2026, 4, 1, 14, 32, 0),
|
|
)
|
|
assert "Das ist der Inhalt." in open(path).read()
|
|
|
|
|
|
def test_slugify():
|
|
from output import slugify
|
|
assert slugify("Mein erstes Diktat") == "mein-erstes-diktat"
|
|
assert slugify("test -- foo") == "test-foo"
|
|
|
|
|
|
def test_write_meeting_docs_creates_three_files(tmp_path):
|
|
from output import write_meeting_docs
|
|
from datetime import datetime
|
|
aligned = [("Thomas", "Gut, dann fangen wir an."), ("Möller", "Ich hab das vorbereitet.")]
|
|
paths = write_meeting_docs(
|
|
aligned_segments=aligned,
|
|
summary="# Meeting\n\n## Wichtigste Punkte\n- Budget besprochen",
|
|
speakers=["Thomas", "Möller"],
|
|
duration_min=5,
|
|
output_dir=str(tmp_path),
|
|
dt=datetime(2026, 4, 2, 14, 30),
|
|
)
|
|
assert len(paths) == 3
|
|
index_content = open(paths["index"]).read()
|
|
assert "Thomas" in index_content
|
|
assert "transkript" in index_content
|
|
transcript_content = open(paths["transkript"]).read()
|
|
assert "**Thomas:**" in transcript_content
|
|
assert "Gut, dann fangen wir an." in transcript_content
|
|
summary_content = open(paths["zusammenfassung"]).read()
|
|
assert "Budget besprochen" in summary_content
|