Coverage for tests/test_nurin.py: 100%
10 statements
« prev ^ index » next coverage.py v7.1.0, created at 2023-02-07 20:24 +0200
« prev ^ index » next coverage.py v7.1.0, created at 2023-02-07 20:24 +0200
1from subprocess import run
2from unittest.mock import patch
4from click.testing import CliRunner
6from nurin.cli import cli
9def test_nurin() -> None:
10 with patch("subprocess.run", wraps=run) as mock_run:
11 runner = CliRunner()
12 result = runner.invoke(
13 cli,
14 [
15 "--max-cycles=1",
16 "--regular-check-interval=0",
17 "--ping-target=localhost",
18 ],
19 catch_exceptions=False,
20 )
21 assert result.exit_code == 0
22 assert mock_run.call_count == 1 # ping!