Skip to content

Commit 414a40a

Browse files
committed
added cli tests
1 parent be9c3ce commit 414a40a

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/test_cli.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from unittest.mock import patch
2+
3+
from click.testing import CliRunner
4+
5+
import teufa.cli
6+
7+
8+
@patch("teufa.server.Application")
9+
def test_cli_server(MockApplication):
10+
runner = CliRunner()
11+
12+
result = runner.invoke(teufa.cli.server)
13+
assert result.exit_code == 0
14+
15+
MockApplication.assert_called_once_with(
16+
{
17+
"bind": "127.0.0.1:8000",
18+
"reload": False,
19+
}
20+
)
21+
MockApplication.return_value.run.assert_called_once_with()
22+
23+
24+
@patch("teufa.server.Application")
25+
def test_cli_server_dev(MockApplication):
26+
runner = CliRunner()
27+
28+
result = runner.invoke(teufa.cli.server, ["--dev"])
29+
assert result.exit_code == 0
30+
31+
MockApplication.assert_called_once_with(
32+
{
33+
"bind": "127.0.0.1:8000",
34+
"reload": True,
35+
}
36+
)
37+
MockApplication.return_value.run.assert_called_once_with()

0 commit comments

Comments
 (0)