Files
pgames-manager/backend/tests/test_single_game.py
T
mrleo1nid f9eb5c1212
CI / frontend (push) Failing after 15s
CI / backend (push) Failing after 37s
feat: improve RenPy conversion and support MIST runtime
2026-10-25 23:16:33 +03:00

38 lines
1.4 KiB
Python

import asyncio
import json
import zipfile
import pytest
from app.import_library import main
@pytest.mark.parametrize("archived", [False, True])
def test_single_checks_distribution_without_treating_contents_as_games(tmp_path, archived):
source = tmp_path / "One"
(source / "game").mkdir(parents=True)
(source / "game/script.rpy").write_text('label start:\n "Hello"\n return\n')
if archived:
archive = tmp_path / "One.zip"
with zipfile.ZipFile(archive, "w") as handle:
handle.write(source / "game/script.rpy", "One/game/script.rpy")
source = archive
output = tmp_path / "report.json"
asyncio.run(main([str(source), "--single", "--check", "--output", str(output)]))
results = json.loads(output.read_text(encoding="utf-8"))
assert len(results) == 1
assert results[0]["game"] == source.name
assert results[0]["compatible"] is True
assert "versionId" not in results[0]
def test_single_rejection_writes_report_and_returns_failure(tmp_path):
source = tmp_path / "game"
source.mkdir()
(source / "script.rpy").write_text("label start:\n jump missing\n")
output = tmp_path / "report.json"
with pytest.raises(SystemExit) as error:
asyncio.run(main([str(source), "--single", "--check", "--output", str(output)]))
assert error.value.code == 2
assert json.loads(output.read_text(encoding="utf-8"))[0]["compatible"] is False