def _test_relevant_values_common(self, values):
        option = "rsa_key_size"
        mock_parser = mock.Mock(args=["--standalone"], verb="certonly", defaults={option: cli.flag_default(option)})

        from certbot.storage import relevant_values

        with mock.patch("certbot.cli.helpful_parser", mock_parser):
            return relevant_values(values)
Exemple #2
0
    def _test_relevant_values_common(self, values):
        option = "rsa_key_size"
        mock_parser = mock.Mock(args=["--standalone"], verb="certonly",
                                defaults={option: cli.flag_default(option)})

        from certbot.storage import relevant_values
        with mock.patch("certbot.cli.helpful_parser", mock_parser):
            return relevant_values(values)
Exemple #3
0
 def test_relevant_values_default(self, mock_parser):
     """Test that relevant_values() can reject a default value."""
     # pylint: disable=protected-access
     from certbot import storage
     mock_parser.verb = "certonly"
     mock_parser.args = ["--standalone"]
     mock_action = mock.Mock(dest="rsa_key_size", default=2048)
     mock_parser.parser._actions = [mock_action]
     self.assertEqual(storage.relevant_values({"rsa_key_size": 2048}), {})
Exemple #4
0
 def test_relevant_values_default(self, mock_parser):
     """Test that relevant_values() can reject a default value."""
     # pylint: disable=protected-access
     from certbot import storage
     mock_parser.verb = "certonly"
     mock_parser.args = ["--standalone"]
     mock_action = mock.Mock(dest="rsa_key_size", default=2048)
     mock_parser.parser._actions = [mock_action]
     self.assertEqual(storage.relevant_values({"rsa_key_size": 2048}), {})
    def _test_relevant_values_common(self, values):
        defaults = dict((option, cli.flag_default(option))
                        for option in ("authenticator", "installer",
                                       "rsa_key_size", "server",))
        mock_parser = mock.Mock(args=[], verb="plugins",
                                defaults=defaults)

        # make a copy to ensure values isn't modified
        values = values.copy()
        values.setdefault("server", defaults["server"])
        expected_server = values["server"]

        from certbot.storage import relevant_values
        with mock.patch("certbot.cli.helpful_parser", mock_parser):
            rv = relevant_values(values)
        self.assertIn("server", rv)
        self.assertEqual(rv.pop("server"), expected_server)
        return rv
Exemple #6
0
    def _test_relevant_values_common(self, values):
        defaults = dict((option, cli.flag_default(option))
                        for option in ("authenticator", "installer",
                                       "rsa_key_size", "server",))
        mock_parser = mock.Mock(args=[], verb="plugins",
                                defaults=defaults)

        # make a copy to ensure values isn't modified
        values = values.copy()
        values.setdefault("server", defaults["server"])
        expected_server = values["server"]

        from certbot.storage import relevant_values
        with mock.patch("certbot.cli.helpful_parser", mock_parser):
            rv = relevant_values(values)
        self.assertIn("server", rv)
        self.assertEqual(rv.pop("server"), expected_server)
        return rv
Exemple #7
0
 def _call(self, *args, **kwargs):
     from certbot.storage import relevant_values
     return relevant_values(*args, **kwargs)
 def _call(self, *args, **kwargs):
     from certbot.storage import relevant_values
     return relevant_values(*args, **kwargs)