File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
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 ()
You can’t perform that action at this time.
0 commit comments