test_api.py 580 B

1234567891011121314151617181920212223
  1. import pathlib
  2. import shutil
  3. import subprocess
  4. import pytest
  5. import tooncher
  6. def test_start_engine():
  7. process = tooncher.start_engine(
  8. engine_path=pathlib.Path(shutil.which("printenv")),
  9. gameserver="gameserver",
  10. playcookie="cookie",
  11. stdout=subprocess.PIPE,
  12. stderr=subprocess.PIPE,
  13. )
  14. assert isinstance(process, subprocess.Popen)
  15. stdout, stderr = process.communicate()
  16. assert b"" == stderr
  17. env = stdout.strip().split(b"\n")
  18. assert b"TTR_GAMESERVER=gameserver" in env
  19. assert b"TTR_PLAYCOOKIE=cookie" in env