@@ -23,6 +23,48 @@ def mock_commands_user(mock_commands_user):
2323 return mock_commands_user (MODULE )
2424
2525
26+ def test_main_info (mock_commands_info ):
27+ main (argv = ["info" ])
28+
29+ mock_commands_info .assert_called_once ()
30+
31+
32+ def test_main_info_default (mock_commands_info ):
33+ main (argv = [])
34+
35+ mock_commands_info .assert_called_once ()
36+
37+
38+ def test_main_init_default (mock_commands_init ):
39+ main (argv = ["init" , "username" ])
40+
41+ mock_commands_init .assert_called_once ()
42+ call_args = mock_commands_init .call_args .args
43+ assert Namespace (func = mock_commands_init , command = "init" , username = "username" , gam = False , gyb = False ) in call_args
44+
45+
46+ def test_main_init_gam (mock_commands_init ):
47+ main (argv = ["init" , "username" , "--gam" ])
48+
49+ mock_commands_init .assert_called_once ()
50+ call_args = mock_commands_init .call_args .args
51+ assert Namespace (func = mock_commands_init , command = "init" , username = "username" , gam = True , gyb = False ) in call_args
52+
53+
54+ def test_main_init_gyb (mock_commands_init ):
55+ main (argv = ["init" , "username" , "--gyb" ])
56+
57+ mock_commands_init .assert_called_once ()
58+ call_args = mock_commands_init .call_args .args
59+ assert Namespace (func = mock_commands_init , command = "init" , username = "username" , gam = False , gyb = True ) in call_args
60+
61+
62+ def test_main_init_no_username (mock_commands_init ):
63+ with pytest .raises (SystemExit ):
64+ main (argv = ["init" ])
65+ assert mock_commands_init .call_count == 0
66+
67+
2668def test_main_user_create (mock_commands_user ):
2769 main (argv = ["user" , "create" , "username" ])
2870
@@ -113,48 +155,6 @@ def test_main_user_delete_no_username(mock_commands_user):
113155 assert mock_commands_user .call_count == 0
114156
115157
116- def test_main_info (mock_commands_info ):
117- main (argv = ["info" ])
118-
119- mock_commands_info .assert_called_once ()
120-
121-
122- def test_main_info_default (mock_commands_info ):
123- main (argv = [])
124-
125- mock_commands_info .assert_called_once ()
126-
127-
128- def test_main_init_default (mock_commands_init ):
129- main (argv = ["init" , "username" ])
130-
131- mock_commands_init .assert_called_once ()
132- call_args = mock_commands_init .call_args .args
133- assert Namespace (func = mock_commands_init , command = "init" , username = "username" , gam = False , gyb = False ) in call_args
134-
135-
136- def test_main_init_gam (mock_commands_init ):
137- main (argv = ["init" , "username" , "--gam" ])
138-
139- mock_commands_init .assert_called_once ()
140- call_args = mock_commands_init .call_args .args
141- assert Namespace (func = mock_commands_init , command = "init" , username = "username" , gam = True , gyb = False ) in call_args
142-
143-
144- def test_main_init_gyb (mock_commands_init ):
145- main (argv = ["init" , "username" , "--gyb" ])
146-
147- mock_commands_init .assert_called_once ()
148- call_args = mock_commands_init .call_args .args
149- assert Namespace (func = mock_commands_init , command = "init" , username = "username" , gam = False , gyb = True ) in call_args
150-
151-
152- def test_main_init_no_username (mock_commands_init ):
153- with pytest .raises (SystemExit ):
154- main (argv = ["init" ])
155- assert mock_commands_init .call_count == 0
156-
157-
158158def test_main_user_offboard (mock_commands_user ):
159159 main (argv = ["user" , "offboard" , "username" ])
160160
0 commit comments