/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-07 20:37:15 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 382.
  • Revision ID: teddy@recompile.se-20190307203715-nilyilg9adr8q7bm
mandos-ctl: Add tests for short options

* mandos-ctl
  (Test_command_from_options.test_print_table_verbose_short): New.
  (Test_command_from_options.test_enable_short): - '' -
  (Test_command_from_options.test_disable_short): - '' -
  (Test_command_from_options.test_bump_timeout_short): - '' -
  (Test_command_from_options.test_remove_short): - '' -
  (Test_command_from_options.test_checker_short): - '' -
  (Test_command_from_options.test_timeout_short): - '' -
  (Test_command_from_options.test_interval_short): - '' -
  (Test_command_from_options.test_host_short): - '' -
  (Test_command_from_options.test_secret_devnull_short): - '' -
  (Test_command_from_options.test_secret_tempfile_short): - '' -
  (Test_command_from_options.test_approve_short): - '' -
  (Test_command_from_options.test_deny_short): - '' -
  (Test_command_from_options.test_is_enabled_short): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
644
644
    return commands
645
645
 
646
646
 
647
 
def check_option_syntax(parser, options):
 
647
def main():
 
648
    parser = argparse.ArgumentParser()
 
649
 
 
650
    add_command_line_options(parser)
 
651
 
 
652
    options = parser.parse_args()
648
653
 
649
654
    def has_actions(options):
650
655
        return any((options.enable,
678
683
    if options.is_enabled and len(options.client) > 1:
679
684
        parser.error("--is-enabled requires exactly one client")
680
685
 
681
 
 
682
 
def main():
683
 
    parser = argparse.ArgumentParser()
684
 
 
685
 
    add_command_line_options(parser)
686
 
 
687
 
    options = parser.parse_args()
688
 
 
689
 
    check_option_syntax(parser, options)
690
 
 
691
686
    clientnames = options.client
692
687
 
693
688
    try:
1160
1155
        """Assert that parsing ARGS should result in an instance of
1161
1156
COMMAND_CLS with (optionally) all supplied attributes (CMD_ATTRS)."""
1162
1157
        options = self.parser.parse_args(args)
1163
 
        check_option_syntax(self.parser, options)
1164
1158
        commands = commands_from_options(options)
1165
1159
        self.assertEqual(len(commands), 1)
1166
1160
        command = commands[0]