Files
pocketpaw/tests/test_cli_flags.py
Rohit Kushwaha 10243f9580 fix(cli): reject --telegram combined with other channel flags (#743)
Telegram is the legacy pairing-only mode; combining it with
--discord/--slack/--whatsapp/etc produced confusing startup state where
the dashboard never came up but the extra channels silently ran. Fail
fast via argparse error so the user gets a clear message.

Uses `getattr(args, flag, False)` so unregistered flags don't crash.
Leaves `_check_extras_installed` and the rest of the main() control
flow untouched (earlier iterations of the PR moved it too early and
broke `doctor`/`status`).

Reduces the original test to the conflict cases only — asserting on the
non-conflict path would require mocking the full startup pipeline.

Co-Authored-By: Aravindavenge <119057955+Aravindavenge@users.noreply.github.com>
2026-04-22 05:41:02 +05:30

17 lines
590 B
Python

"""Tests for CLI flag validation in pocketpaw.__main__."""
from __future__ import annotations
import pytest
@pytest.mark.parametrize("conflict_flag", ["--discord", "--slack", "--whatsapp"])
def test_telegram_conflicts_with_other_channel_flag(monkeypatch, conflict_flag):
"""--telegram combined with another channel flag must exit via argparse error (code 2)."""
from pocketpaw.__main__ import main
monkeypatch.setattr("sys.argv", ["pocketpaw", "--telegram", conflict_flag])
with pytest.raises(SystemExit) as exc_info:
main()
assert exc_info.value.code == 2