clan-core/pkgs/clan-cli/tests/test_cli.py
Jörg Thalheim 0b654c7434
All checks were successful
build / test (push) Successful in 11s
apply treefmt
2023-07-21 14:11:46 +02:00

23 lines
566 B
Python

import sys
import pytest
import clan_cli
def test_no_args(
capsys: pytest.CaptureFixture, monkeypatch: pytest.MonkeyPatch
) -> None:
monkeypatch.setattr(sys, "argv", [""])
clan_cli.main()
captured = capsys.readouterr()
assert captured.out.startswith("usage:")
def test_help(capsys: pytest.CaptureFixture, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(sys, "argv", ["", "--help"])
with pytest.raises(SystemExit):
clan_cli.main()
captured = capsys.readouterr()
assert captured.out.startswith("usage:")