Example #1
0
    def test__init___warn_unsupported_config_options(self):
        config = ConfigHelper(redirect=True, hsts=True)
        installer = mock.MagicMock()
        installer.supported_enhancements.return_value = ["redirect"]

        with mock.patch('certbot.client.logger') as mock_logger:
            from certbot.client import Client
            Client(config=config,
                   account_=self.account,
                   auth=None,
                   installer=installer,
                   acme=self.acme)
            mock_logger.warning.assert_called_once_with(mock.ANY)
Example #2
0
    def setUp(self):
        super(ClientTestCommon, self).setUp()
        self.config.no_verify_ssl = False
        self.config.allow_subset_of_names = False

        self.account = mock.MagicMock(**{"key.pem": KEY})

        from certbot.client import Client
        with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as acme:
            self.acme_client = acme
            self.acme = acme.return_value = mock.MagicMock()
            self.client = Client(
                config=self.config, account_=self.account,
                auth=None, installer=None)
Example #3
0
    def setUp(self):
        self.config = mock.MagicMock(
            no_verify_ssl=False, config_dir="/etc/letsencrypt", allow_subset_of_names=False)
        # pylint: disable=star-args
        self.account = mock.MagicMock(**{"key.pem": KEY})
        self.eg_domains = ["example.com", "www.example.com"]

        from certbot.client import Client
        with mock.patch("certbot.client.acme_client.Client") as acme:
            self.acme_client = acme
            self.acme = acme.return_value = mock.MagicMock()
            self.client = Client(
                config=self.config, account_=self.account,
                auth=None, installer=None)
Example #4
0
def _main(domains=[], email=None, instance_name="", consul_manager=None):
    ns = ConfigNamespace(email, domains)
    config = NamespaceConfig(ns)
    zope.component.provideUtility(config)

    ams = AccountMemoryStorage()
    acc, acme = register(config, ams)

    authenticator = RpaasLeAuthenticator(instance_name,
                                         config=config,
                                         name='',
                                         consul_manager=consul_manager)
    installer = None
    lec = Client(config, acc, authenticator, installer, acme)
    certr, chain, key, _ = lec.obtain_certificate(domains)
    return (
        OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM,
                                        certr.body),
        crypto_util.dump_pyopenssl_chain(chain),
        key.pem,
    )