Files
redmine/tests/test_tui_tty_guard.py
Jason Thistlethwaite 9ee9eb3ec6 Organized
2026-10-17 20:50:35 -04:00

29 lines
757 B
Python

"""Curses launch must fail clearly outside a real terminal."""
from __future__ import annotations
from pathlib import Path
import redmine_ticket_tui
def test_tui_refuses_non_tty_with_clear_message(monkeypatch, capsys):
class Args:
cache_dir = Path("/tmp/redmine-cache")
project = "customer-service"
base_url = "https://rm.ldrprep.com"
allow_prod_writes = False
apply = False
class Cache:
cache_dir = Args.cache_dir
project = Args.project
monkeypatch.setattr(redmine_ticket_tui.os, "isatty", lambda _fd: False)
rc = redmine_ticket_tui.main_cli(Args(), Cache())
captured = capsys.readouterr()
assert rc == 1
assert "requires an interactive terminal" in captured.err