summaryrefslogtreecommitdiffstats
path: root/tests/test_subcmds_init.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_subcmds_init.py')
-rw-r--r--tests/test_subcmds_init.py51
1 files changed, 24 insertions, 27 deletions
diff --git a/tests/test_subcmds_init.py b/tests/test_subcmds_init.py
index af4346de..25e5be56 100644
--- a/tests/test_subcmds_init.py
+++ b/tests/test_subcmds_init.py
@@ -20,30 +20,27 @@ from subcmds import init
20 20
21 21
22class InitCommand(unittest.TestCase): 22class InitCommand(unittest.TestCase):
23 """Check registered all_commands.""" 23 """Check registered all_commands."""
24 24
25 def setUp(self): 25 def setUp(self):
26 self.cmd = init.Init() 26 self.cmd = init.Init()
27 27
28 def test_cli_parser_good(self): 28 def test_cli_parser_good(self):
29 """Check valid command line options.""" 29 """Check valid command line options."""
30 ARGV = ( 30 ARGV = ([],)
31 [], 31 for argv in ARGV:
32 ) 32 opts, args = self.cmd.OptionParser.parse_args(argv)
33 for argv in ARGV: 33 self.cmd.ValidateOptions(opts, args)
34 opts, args = self.cmd.OptionParser.parse_args(argv) 34
35 self.cmd.ValidateOptions(opts, args) 35 def test_cli_parser_bad(self):
36 36 """Check invalid command line options."""
37 def test_cli_parser_bad(self): 37 ARGV = (
38 """Check invalid command line options.""" 38 # Too many arguments.
39 ARGV = ( 39 ["url", "asdf"],
40 # Too many arguments. 40 # Conflicting options.
41 ['url', 'asdf'], 41 ["--mirror", "--archive"],
42 42 )
43 # Conflicting options. 43 for argv in ARGV:
44 ['--mirror', '--archive'], 44 opts, args = self.cmd.OptionParser.parse_args(argv)
45 ) 45 with self.assertRaises(SystemExit):
46 for argv in ARGV: 46 self.cmd.ValidateOptions(opts, args)
47 opts, args = self.cmd.OptionParser.parse_args(argv)
48 with self.assertRaises(SystemExit):
49 self.cmd.ValidateOptions(opts, args)