36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from pathlib import Path
|
|||
|
|
|
||
|
|
from apps.cli.run_combo import promote_scoped_combo_outputs
|
||
|
|
|
||
|
|
|
||
|
|
def test_promote_scoped_combo_outputs_prefers_scoped_artifacts(tmp_path):
|
||
|
|
workspace = tmp_path / "job"
|
||
|
|
final_dir = workspace / "final"
|
||
|
|
final_dir.mkdir(parents=True)
|
||
|
|
short_pdf = final_dir / "Lc.SPL.combo.pdf"
|
||
|
|
short_png = final_dir / "Lc.SPL.combo.png"
|
||
|
|
short_pdf.write_bytes(b"%PDF-1.4\n")
|
||
|
|
short_png.write_bytes(b"\x89PNG\r\n\x1a\n")
|
||
|
|
|
||
|
|
result = {
|
||
|
|
"success": True,
|
||
|
|
"output_pdf": str(short_pdf),
|
||
|
|
"output_png": str(short_png),
|
||
|
|
}
|
||
|
|
|
||
|
|
promoted = promote_scoped_combo_outputs(
|
||
|
|
workspace,
|
||
|
|
"Lc.SPL",
|
||
|
|
"SPL.target-Lc.target_only",
|
||
|
|
result,
|
||
|
|
)
|
||
|
|
|
||
|
|
scoped_pdf = final_dir / "Lc.SPL.SPL.target-Lc.target_only.combo.pdf"
|
||
|
|
scoped_png = final_dir / "Lc.SPL.SPL.target-Lc.target_only.combo.png"
|
||
|
|
assert Path(promoted["output_pdf"]) == scoped_pdf
|
||
|
|
assert Path(promoted["output_png"]) == scoped_png
|
||
|
|
assert Path(promoted["short_output_pdf"]) == short_pdf
|
||
|
|
assert Path(promoted["short_output_png"]) == short_png
|
||
|
|
assert scoped_pdf.read_bytes() == short_pdf.read_bytes()
|
||
|
|
assert scoped_png.read_bytes() == short_png.read_bytes()
|