/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to mandos-ctl

  • Committer: Teddy Hogeborn
  • Date: 2019-03-06 17:59:11 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 382.
  • Revision ID: teddy@recompile.se-20190306175911-bl5eyej4cb9vp9u8
mandos-ctl: Add more tests, starting with the --verbose option

* mandos-ctl (TestOptions): New.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1115
1115
    values_to_set = ["P0D", "PT5M", "PT1S", "PT120S", "P1Y"]
1116
1116
    values_to_get = [0, 300000, 1000, 120000, 31449600000]
1117
1117
 
 
1118
class TestOptions(unittest.TestCase):
 
1119
    def setUp(self):
 
1120
        self.parser = argparse.ArgumentParser()
 
1121
        add_command_line_options(self.parser)
 
1122
    def commands_from_args(self, args):
 
1123
        options = self.parser.parse_args(args)
 
1124
        return commands_from_options(options)
 
1125
    def test_default_is_show_table(self):
 
1126
        commands = self.commands_from_args([])
 
1127
        self.assertEqual(len(commands), 1)
 
1128
        command = commands[0]
 
1129
        self.assertIsInstance(command, PrintTableCmd)
 
1130
        self.assertEqual(command.verbose, False)
 
1131
    def test_show_table_verbose(self):
 
1132
        commands = self.commands_from_args(["--verbose"])
 
1133
        self.assertEqual(len(commands), 1)
 
1134
        command = commands[0]
 
1135
        self.assertIsInstance(command, PrintTableCmd)
 
1136
        self.assertEqual(command.verbose, True)
 
1137
 
1118
1138
 
1119
1139
 
1120
1140
def should_only_run_tests():