Esempio n. 1
0
    def test_parse_args_hosts_and_auto_hosts(self):
        arg_parser = HelpfulArgumentParser(['--hsts', '--auto-hsts'], {})

        arg_parser.add(None, "--hsts", action="store_true", dest="hsts")
        arg_parser.add(None,
                       "--auto-hsts",
                       action="store_true",
                       dest="auto_hsts")
        # The following arguments are added because they have to be defined
        # in order for arg_parser to run completely. They are not used for the
        # test.
        arg_parser.add(None,
                       constants.FORCE_INTERACTIVE_FLAG,
                       action="store_true")
        arg_parser.add(None,
                       "--non-interactive",
                       dest="noninteractive_mode",
                       action="store_true")
        arg_parser.add(None, "--staging")
        arg_parser.add(None, "--dry-run")
        arg_parser.add(None, "--csr")
        arg_parser.add(None, "--must-staple")
        arg_parser.add(None, "--validate-hooks")
        arg_parser.add(None, "--allow-subset-of-names")
        with self.assertRaises(errors.Error):
            arg_parser.parse_args()
Esempio n. 2
0
    def test_parse_args_renew_force_interactive(self):
        arg_parser = HelpfulArgumentParser(['renew', '--force-interactive'],
                                           {})
        arg_parser.add(None,
                       constants.FORCE_INTERACTIVE_FLAG,
                       action="store_true")

        with self.assertRaises(errors.Error):
            arg_parser.parse_args()
Esempio n. 3
0
    def test_parse_args_non_interactive_and_force_interactive(self):
        arg_parser = HelpfulArgumentParser(
            ['--force-interactive', '--non-interactive'], {})
        arg_parser.add(None,
                       constants.FORCE_INTERACTIVE_FLAG,
                       action="store_true")
        arg_parser.add(None,
                       "--non-interactive",
                       dest="noninteractive_mode",
                       action="store_true")

        with self.assertRaises(errors.Error):
            arg_parser.parse_args()
Esempio n. 4
0
 def test_no_default_detection_modifications(self, mock_modify):
     arg_parser = HelpfulArgumentParser(["run"], {}, detect_defaults=True)
     arg_parser.add_deprecated_argument("--foo", 0)
     arg_parser.parse_args()
     mock_modify.assert_not_called()