summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-cli/tests/test_selftest.py
blob: ea49fa1d9eba830878685a97abb0926c9a918f3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""The frozen build's self-test, run here from source so it cannot rot unseen."""

from meshbay_cli import __main__ as cli


def test_the_self_test_passes_from_source(monkeypatch, tmp_path, capsys):
    monkeypatch.setenv("MESHBAY_CLI_SELFTEST", "1")
    monkeypatch.setenv("MESHBAY_CLI_HOME", str(tmp_path))    # restored after
    assert cli.main([]) == 0
    assert "self-test ok" in capsys.readouterr().out


def test_it_is_not_reachable_with_arguments(monkeypatch, capsys):
    monkeypatch.setenv("MESHBAY_CLI_SELFTEST", "1")
    assert cli.main(["--version"]) == 0
    assert "self-test" not in capsys.readouterr().out