Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
cduriau committed Feb 4, 2024
1 parent 717b5b8 commit bc26c92
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest

# package
from packagerbuddy import cli
from packagerbuddy import cli, configutils


def test_run():
Expand Down Expand Up @@ -38,3 +38,17 @@ def mock_os_makedirs(p: str):
cli.run(["setup"])

assert exc.value.code == 0


def test_list_available_software(capsys, monkeypatch: pytest.MonkeyPatch):
def mock_configutils_load() -> dict:
return {"a": "foo", "b": "bar"}

monkeypatch.setattr(configutils, "load", mock_configutils_load)

with pytest.raises(SystemExit) as exc:
cli.run(["avail"])

assert exc.value.code == 0
out, _err = capsys.readouterr()
assert out == "\n".join(["a", "b"]) + "\n"

0 comments on commit bc26c92

Please sign in to comment.