mirror of
https://github.com/certbot/certbot.git
synced 2025-08-06 16:42:41 +03:00
Make uncomplicated modules private (#7528)
* Create _internal package for Certbot's non-public modules * Move account.py to _internal * Move auth_handler.py to _internal * Move cert_manager.py to _internal * Move client.py to _internal * Move error_handler.py to _internal * Move lock.py to _internal * Move main.py to _internal * Move notify.py to _internal * Move ocsp.py to _internal * Move renewal.py to _internal * Move reporter.py to _internal * Move storage.py to _internal * Move updater.py to _internal * update apache and nginx oldest requirements * Keep the lock file as certbot.lock * nginx oldest tests still need to rely on newer certbot * python doesn't have good dependency resolution, so specify the transitive dependency * update required minimum versions in nginx setup.py
This commit is contained in:
@@ -2345,7 +2345,7 @@ class ApacheConfigurator(common.Installer):
|
|||||||
Enable the AutoHSTS enhancement for defined domains
|
Enable the AutoHSTS enhancement for defined domains
|
||||||
|
|
||||||
:param _unused_lineage: Certificate lineage object, unused
|
:param _unused_lineage: Certificate lineage object, unused
|
||||||
:type _unused_lineage: certbot.storage.RenewableCert
|
:type _unused_lineage: certbot._internal.storage.RenewableCert
|
||||||
|
|
||||||
:param domains: List of domains in certificate to enhance
|
:param domains: List of domains in certificate to enhance
|
||||||
:type domains: str
|
:type domains: str
|
||||||
@@ -2470,7 +2470,7 @@ class ApacheConfigurator(common.Installer):
|
|||||||
and changes the HSTS max-age to a high value.
|
and changes the HSTS max-age to a high value.
|
||||||
|
|
||||||
:param lineage: Certificate lineage object
|
:param lineage: Certificate lineage object
|
||||||
:type lineage: certbot.storage.RenewableCert
|
:type lineage: certbot._internal.storage.RenewableCert
|
||||||
"""
|
"""
|
||||||
self._autohsts_fetch_state()
|
self._autohsts_fetch_state()
|
||||||
if not self._autohsts:
|
if not self._autohsts:
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
# Remember to update setup.py to match the package versions below.
|
# Remember to update setup.py to match the package versions below.
|
||||||
acme[dev]==0.29.0
|
-e acme[dev]
|
||||||
certbot[dev]==0.36.0
|
-e .[dev]
|
||||||
|
@@ -9,8 +9,8 @@ version = '1.0.0.dev0'
|
|||||||
# Remember to update local-oldest-requirements.txt when changing the minimum
|
# Remember to update local-oldest-requirements.txt when changing the minimum
|
||||||
# acme/certbot version.
|
# acme/certbot version.
|
||||||
install_requires = [
|
install_requires = [
|
||||||
'acme>=0.29.0',
|
'acme>=1.0.0.dev0',
|
||||||
'certbot>=0.35.0',
|
'certbot>=1.0.0.dev0',
|
||||||
'mock',
|
'mock',
|
||||||
'PyOpenSSL',
|
'PyOpenSSL',
|
||||||
'pyparsing>=1.5.5', # Python3 support; perhaps unnecessary?
|
'pyparsing>=1.5.5', # Python3 support; perhaps unnecessary?
|
||||||
|
6
certbot/_internal/__init__.py
Normal file
6
certbot/_internal/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
"""
|
||||||
|
Modules internal to Certbot.
|
||||||
|
|
||||||
|
This package contains modules that are not considered part of Certbot's public
|
||||||
|
API. They may be changed without updating Certbot's major version.
|
||||||
|
"""
|
@@ -13,7 +13,7 @@ from acme.magic_typing import Dict, List, Tuple
|
|||||||
# pylint: enable=unused-import, no-name-in-module
|
# pylint: enable=unused-import, no-name-in-module
|
||||||
from certbot import achallenges
|
from certbot import achallenges
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot import error_handler
|
from certbot._internal import error_handler
|
||||||
from certbot import interfaces
|
from certbot import interfaces
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -29,7 +29,7 @@ class AuthHandler(object):
|
|||||||
:ivar acme.client.BackwardsCompatibleClientV2 acme_client: ACME client API.
|
:ivar acme.client.BackwardsCompatibleClientV2 acme_client: ACME client API.
|
||||||
|
|
||||||
:ivar account: Client's Account
|
:ivar account: Client's Account
|
||||||
:type account: :class:`certbot.account.Account`
|
:type account: :class:`certbot._internal.account.Account`
|
||||||
|
|
||||||
:ivar list pref_challs: sorted user specified preferred challenges
|
:ivar list pref_challs: sorted user specified preferred challenges
|
||||||
type strings with the most preferred challenge listed first
|
type strings with the most preferred challenge listed first
|
@@ -12,8 +12,8 @@ from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-
|
|||||||
from certbot import crypto_util
|
from certbot import crypto_util
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot import interfaces
|
from certbot import interfaces
|
||||||
from certbot import ocsp
|
from certbot._internal import ocsp
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
from certbot import util
|
from certbot import util
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.display import util as display_util
|
from certbot.display import util as display_util
|
@@ -18,16 +18,16 @@ from acme import messages
|
|||||||
from acme.magic_typing import Optional, List # pylint: disable=unused-import,no-name-in-module
|
from acme.magic_typing import Optional, List # pylint: disable=unused-import,no-name-in-module
|
||||||
|
|
||||||
import certbot
|
import certbot
|
||||||
from certbot import account
|
from certbot._internal import account
|
||||||
from certbot import auth_handler
|
from certbot._internal import auth_handler
|
||||||
from certbot import cli
|
from certbot import cli
|
||||||
from certbot import constants
|
from certbot import constants
|
||||||
from certbot import crypto_util
|
from certbot import crypto_util
|
||||||
from certbot import eff
|
from certbot import eff
|
||||||
from certbot import error_handler
|
from certbot._internal import error_handler
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot import interfaces
|
from certbot import interfaces
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
from certbot import util
|
from certbot import util
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.display import enhancements
|
from certbot.display import enhancements
|
||||||
@@ -408,7 +408,7 @@ class Client(object):
|
|||||||
:param certname: requested name of lineage
|
:param certname: requested name of lineage
|
||||||
:type certname: `str` or `None`
|
:type certname: `str` or `None`
|
||||||
|
|
||||||
:returns: A new :class:`certbot.storage.RenewableCert` instance
|
:returns: A new :class:`certbot._internal.storage.RenewableCert` instance
|
||||||
referred to the enrolled cert lineage, False if the cert could not
|
referred to the enrolled cert lineage, False if the cert could not
|
||||||
be obtained, or None if doing a successful dry run.
|
be obtained, or None if doing a successful dry run.
|
||||||
|
|
@@ -14,10 +14,10 @@ from acme import errors as acme_errors
|
|||||||
from acme.magic_typing import Union # pylint: disable=unused-import, no-name-in-module
|
from acme.magic_typing import Union # pylint: disable=unused-import, no-name-in-module
|
||||||
|
|
||||||
import certbot
|
import certbot
|
||||||
from certbot import account
|
from certbot._internal import account
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
from certbot import cli
|
from certbot import cli
|
||||||
from certbot import client
|
from certbot._internal import client
|
||||||
from certbot import configuration
|
from certbot import configuration
|
||||||
from certbot import constants
|
from certbot import constants
|
||||||
from certbot import crypto_util
|
from certbot import crypto_util
|
||||||
@@ -26,10 +26,10 @@ from certbot import errors
|
|||||||
from certbot import hooks
|
from certbot import hooks
|
||||||
from certbot import interfaces
|
from certbot import interfaces
|
||||||
from certbot import log
|
from certbot import log
|
||||||
from certbot import renewal
|
from certbot._internal import renewal
|
||||||
from certbot import reporter
|
from certbot._internal import reporter
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
from certbot import updater
|
from certbot._internal import updater
|
||||||
from certbot import util
|
from certbot import util
|
||||||
from certbot.compat import filesystem
|
from certbot.compat import filesystem
|
||||||
from certbot.compat import misc
|
from certbot.compat import misc
|
||||||
@@ -483,7 +483,7 @@ def _determine_account(config):
|
|||||||
|
|
||||||
:returns: Account and optionally ACME client API (biproduct of new
|
:returns: Account and optionally ACME client API (biproduct of new
|
||||||
registration).
|
registration).
|
||||||
:rtype: tuple of :class:`certbot.account.Account` and :class:`acme.client.Client`
|
:rtype: tuple of :class:`certbot._internal.account.Account` and :class:`acme.client.Client`
|
||||||
|
|
||||||
:raises errors.Error: If unable to register an account with ACME server
|
:raises errors.Error: If unable to register an account with ACME server
|
||||||
|
|
@@ -22,7 +22,7 @@ import requests
|
|||||||
from acme.magic_typing import Optional, Tuple # pylint: disable=unused-import, no-name-in-module
|
from acme.magic_typing import Optional, Tuple # pylint: disable=unused-import, no-name-in-module
|
||||||
from certbot import crypto_util
|
from certbot import crypto_util
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot.storage import RenewableCert # pylint: disable=unused-import
|
from certbot._internal.storage import RenewableCert # pylint: disable=unused-import
|
||||||
from certbot import util
|
from certbot import util
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
@@ -20,8 +20,8 @@ from certbot import crypto_util
|
|||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot import hooks
|
from certbot import hooks
|
||||||
from certbot import interfaces
|
from certbot import interfaces
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
from certbot import updater
|
from certbot._internal import updater
|
||||||
from certbot import util
|
from certbot import util
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.plugins import disco as plugins_disco
|
from certbot.plugins import disco as plugins_disco
|
||||||
@@ -429,7 +429,7 @@ def handle_renewal_request(config): # pylint: disable=too-many-locals,too-many-
|
|||||||
# XXX: ensure that each call here replaces the previous one
|
# XXX: ensure that each call here replaces the previous one
|
||||||
zope.component.provideUtility(lineage_config)
|
zope.component.provideUtility(lineage_config)
|
||||||
renewal_candidate.ensure_deployed()
|
renewal_candidate.ensure_deployed()
|
||||||
from certbot import main
|
from certbot._internal import main
|
||||||
plugins = plugins_disco.PluginsRegistry.find_all()
|
plugins = plugins_disco.PluginsRegistry.find_all()
|
||||||
if should_renew(lineage_config, renewal_candidate):
|
if should_renew(lineage_config, renewal_candidate):
|
||||||
# Apply random sleep upon first renewal if needed
|
# Apply random sleep upon first renewal if needed
|
@@ -15,7 +15,7 @@ import certbot
|
|||||||
from certbot import cli
|
from certbot import cli
|
||||||
from certbot import constants
|
from certbot import constants
|
||||||
from certbot import crypto_util
|
from certbot import crypto_util
|
||||||
from certbot import error_handler
|
from certbot._internal import error_handler
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot import util
|
from certbot import util
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
@@ -248,7 +248,7 @@ def _relevant(namespaces, option):
|
|||||||
|
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
"""
|
"""
|
||||||
from certbot import renewal
|
from certbot._internal import renewal
|
||||||
|
|
||||||
return (option in renewal.CONFIG_ITEMS or
|
return (option in renewal.CONFIG_ITEMS or
|
||||||
any(option.startswith(namespace) for namespace in namespaces))
|
any(option.startswith(namespace) for namespace in namespaces))
|
@@ -438,7 +438,7 @@ class HelpfulArgumentParser(object):
|
|||||||
|
|
||||||
|
|
||||||
def __init__(self, args, plugins, detect_defaults=False):
|
def __init__(self, args, plugins, detect_defaults=False):
|
||||||
from certbot import main
|
from certbot._internal import main
|
||||||
self.VERBS = {
|
self.VERBS = {
|
||||||
"auth": main.certonly,
|
"auth": main.certonly,
|
||||||
"certonly": main.certonly,
|
"certonly": main.certonly,
|
||||||
@@ -1256,7 +1256,7 @@ def prepare_and_parse_args(plugins, args, detect_defaults=False): # pylint: dis
|
|||||||
|
|
||||||
|
|
||||||
def _create_subparsers(helpful):
|
def _create_subparsers(helpful):
|
||||||
from certbot.client import sample_user_agent # avoid import loops
|
from certbot._internal.client import sample_user_agent # avoid import loops
|
||||||
helpful.add(
|
helpful.add(
|
||||||
None, "--user-agent", default=flag_default("user_agent"),
|
None, "--user-agent", default=flag_default("user_agent"),
|
||||||
help='Set a custom user agent string for the client. User agent strings allow '
|
help='Set a custom user agent string for the client. User agent strings allow '
|
||||||
|
@@ -75,7 +75,7 @@ def choose_account(accounts):
|
|||||||
"""Choose an account.
|
"""Choose an account.
|
||||||
|
|
||||||
:param list accounts: Containing at least one
|
:param list accounts: Containing at least one
|
||||||
:class:`~certbot.account.Account`
|
:class:`~certbot._internal.account.Account`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Note this will get more complicated once we start recording authorizations
|
# Note this will get more complicated once we start recording authorizations
|
||||||
|
@@ -178,7 +178,7 @@ class InstallerTest(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class AddrTest(unittest.TestCase):
|
class AddrTest(unittest.TestCase):
|
||||||
"""Tests for certbot.client.plugins.common.Addr."""
|
"""Tests for certbot._internal.client.plugins.common.Addr."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot.plugins.common import Addr
|
from certbot.plugins.common import Addr
|
||||||
|
@@ -51,7 +51,7 @@ def enable(lineage, domains, installer, config):
|
|||||||
Run enable method for each requested enhancement that is supported.
|
Run enable method for each requested enhancement that is supported.
|
||||||
|
|
||||||
:param lineage: Certificate lineage object
|
:param lineage: Certificate lineage object
|
||||||
:type lineage: certbot.storage.RenewableCert
|
:type lineage: certbot._internal.storage.RenewableCert
|
||||||
|
|
||||||
:param domains: List of domains in certificate to enhance
|
:param domains: List of domains in certificate to enhance
|
||||||
:type domains: str
|
:type domains: str
|
||||||
@@ -112,7 +112,7 @@ class AutoHSTSEnhancement(object):
|
|||||||
Implementation of this method should increase the max-age value.
|
Implementation of this method should increase the max-age value.
|
||||||
|
|
||||||
:param lineage: Certificate lineage object
|
:param lineage: Certificate lineage object
|
||||||
:type lineage: certbot.storage.RenewableCert
|
:type lineage: certbot._internal.storage.RenewableCert
|
||||||
|
|
||||||
.. note:: prepare() method inherited from `interfaces.IPlugin` might need
|
.. note:: prepare() method inherited from `interfaces.IPlugin` might need
|
||||||
to be called manually within implementation of this interface method
|
to be called manually within implementation of this interface method
|
||||||
@@ -126,7 +126,7 @@ class AutoHSTSEnhancement(object):
|
|||||||
Long max-age value should be set in implementation of this method.
|
Long max-age value should be set in implementation of this method.
|
||||||
|
|
||||||
:param lineage: Certificate lineage object
|
:param lineage: Certificate lineage object
|
||||||
:type lineage: certbot.storage.RenewableCert
|
:type lineage: certbot._internal.storage.RenewableCert
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@@ -137,7 +137,7 @@ class AutoHSTSEnhancement(object):
|
|||||||
over the subsequent runs of Certbot renew.
|
over the subsequent runs of Certbot renew.
|
||||||
|
|
||||||
:param lineage: Certificate lineage object
|
:param lineage: Certificate lineage object
|
||||||
:type lineage: certbot.storage.RenewableCert
|
:type lineage: certbot._internal.storage.RenewableCert
|
||||||
|
|
||||||
:param domains: List of domains in certificate to enhance
|
:param domains: List of domains in certificate to enhance
|
||||||
:type domains: str
|
:type domains: str
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
"""Tests for certbot.account."""
|
"""Tests for certbot._internal.account."""
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import unittest
|
import unittest
|
||||||
@@ -19,10 +19,10 @@ KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
|
|||||||
|
|
||||||
|
|
||||||
class AccountTest(unittest.TestCase):
|
class AccountTest(unittest.TestCase):
|
||||||
"""Tests for certbot.account.Account."""
|
"""Tests for certbot._internal.account.Account."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot.account import Account
|
from certbot._internal.account import Account
|
||||||
self.regr = mock.MagicMock()
|
self.regr = mock.MagicMock()
|
||||||
self.meta = Account.Meta(
|
self.meta = Account.Meta(
|
||||||
creation_host="test.certbot.org",
|
creation_host="test.certbot.org",
|
||||||
@@ -31,9 +31,9 @@ class AccountTest(unittest.TestCase):
|
|||||||
self.acc = Account(self.regr, KEY, self.meta)
|
self.acc = Account(self.regr, KEY, self.meta)
|
||||||
self.regr.__repr__ = mock.MagicMock(return_value="i_am_a_regr")
|
self.regr.__repr__ = mock.MagicMock(return_value="i_am_a_regr")
|
||||||
|
|
||||||
with mock.patch("certbot.account.socket") as mock_socket:
|
with mock.patch("certbot._internal.account.socket") as mock_socket:
|
||||||
mock_socket.getfqdn.return_value = "test.certbot.org"
|
mock_socket.getfqdn.return_value = "test.certbot.org"
|
||||||
with mock.patch("certbot.account.datetime") as mock_dt:
|
with mock.patch("certbot._internal.account.datetime") as mock_dt:
|
||||||
mock_dt.datetime.now.return_value = self.meta.creation_dt
|
mock_dt.datetime.now.return_value = self.meta.creation_dt
|
||||||
self.acc_no_meta = Account(self.regr, KEY)
|
self.acc_no_meta = Account(self.regr, KEY)
|
||||||
|
|
||||||
@@ -55,18 +55,18 @@ class AccountTest(unittest.TestCase):
|
|||||||
"<Account(i_am_a_regr, 7adac10320f585ddf118429c0c4af2cd, Meta("))
|
"<Account(i_am_a_regr, 7adac10320f585ddf118429c0c4af2cd, Meta("))
|
||||||
|
|
||||||
class ReportNewAccountTest(test_util.ConfigTestCase):
|
class ReportNewAccountTest(test_util.ConfigTestCase):
|
||||||
"""Tests for certbot.account.report_new_account."""
|
"""Tests for certbot._internal.account.report_new_account."""
|
||||||
|
|
||||||
def _call(self):
|
def _call(self):
|
||||||
from certbot.account import report_new_account
|
from certbot._internal.account import report_new_account
|
||||||
report_new_account(self.config)
|
report_new_account(self.config)
|
||||||
|
|
||||||
@mock.patch("certbot.account.zope.component.queryUtility")
|
@mock.patch("certbot._internal.account.zope.component.queryUtility")
|
||||||
def test_no_reporter(self, mock_zope):
|
def test_no_reporter(self, mock_zope):
|
||||||
mock_zope.return_value = None
|
mock_zope.return_value = None
|
||||||
self._call()
|
self._call()
|
||||||
|
|
||||||
@mock.patch("certbot.account.zope.component.queryUtility")
|
@mock.patch("certbot._internal.account.zope.component.queryUtility")
|
||||||
def test_it(self, mock_zope):
|
def test_it(self, mock_zope):
|
||||||
self._call()
|
self._call()
|
||||||
call_list = mock_zope().add_message.call_args_list
|
call_list = mock_zope().add_message.call_args_list
|
||||||
@@ -74,10 +74,10 @@ class ReportNewAccountTest(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class AccountMemoryStorageTest(unittest.TestCase):
|
class AccountMemoryStorageTest(unittest.TestCase):
|
||||||
"""Tests for certbot.account.AccountMemoryStorage."""
|
"""Tests for certbot._internal.account.AccountMemoryStorage."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot.account import AccountMemoryStorage
|
from certbot._internal.account import AccountMemoryStorage
|
||||||
self.storage = AccountMemoryStorage()
|
self.storage = AccountMemoryStorage()
|
||||||
|
|
||||||
def test_it(self):
|
def test_it(self):
|
||||||
@@ -92,16 +92,16 @@ class AccountMemoryStorageTest(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class AccountFileStorageTest(test_util.ConfigTestCase):
|
class AccountFileStorageTest(test_util.ConfigTestCase):
|
||||||
"""Tests for certbot.account.AccountFileStorage."""
|
"""Tests for certbot._internal.account.AccountFileStorage."""
|
||||||
#pylint: disable=too-many-public-methods
|
#pylint: disable=too-many-public-methods
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(AccountFileStorageTest, self).setUp()
|
super(AccountFileStorageTest, self).setUp()
|
||||||
|
|
||||||
from certbot.account import AccountFileStorage
|
from certbot._internal.account import AccountFileStorage
|
||||||
self.storage = AccountFileStorage(self.config)
|
self.storage = AccountFileStorage(self.config)
|
||||||
|
|
||||||
from certbot.account import Account
|
from certbot._internal.account import Account
|
||||||
new_authzr_uri = "hi"
|
new_authzr_uri = "hi"
|
||||||
self.acc = Account(
|
self.acc = Account(
|
||||||
regr=messages.RegistrationResource(
|
regr=messages.RegistrationResource(
|
||||||
@@ -162,7 +162,7 @@ class AccountFileStorageTest(test_util.ConfigTestCase):
|
|||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
self.storage._load_for_server_path = mock.MagicMock(
|
self.storage._load_for_server_path = mock.MagicMock(
|
||||||
side_effect=["x", errors.AccountStorageError, "z"])
|
side_effect=["x", errors.AccountStorageError, "z"])
|
||||||
with mock.patch("certbot.account.os.listdir") as mock_listdir:
|
with mock.patch("certbot._internal.account.os.listdir") as mock_listdir:
|
||||||
mock_listdir.return_value = ["x", "y", "z"]
|
mock_listdir.return_value = ["x", "y", "z"]
|
||||||
self.assertEqual(["x", "z"], self.storage.find_all())
|
self.assertEqual(["x", "z"], self.storage.find_all())
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ class AccountFileStorageTest(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
def _set_server(self, server):
|
def _set_server(self, server):
|
||||||
self.config.server = server
|
self.config.server = server
|
||||||
from certbot.account import AccountFileStorage
|
from certbot._internal.account import AccountFileStorage
|
||||||
self.storage = AccountFileStorage(self.config)
|
self.storage = AccountFileStorage(self.config)
|
||||||
|
|
||||||
def test_find_all_neither_exists(self):
|
def test_find_all_neither_exists(self):
|
||||||
|
@@ -7,7 +7,7 @@ import six
|
|||||||
from acme import challenges
|
from acme import challenges
|
||||||
from acme import messages
|
from acme import messages
|
||||||
|
|
||||||
from certbot import auth_handler
|
from certbot._internal import auth_handler
|
||||||
|
|
||||||
from certbot.tests import util
|
from certbot.tests import util
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
"""Tests for certbot.auth_handler."""
|
"""Tests for certbot._internal.auth_handler."""
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
import unittest
|
import unittest
|
||||||
@@ -24,7 +24,7 @@ class ChallengeFactoryTest(unittest.TestCase):
|
|||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot.auth_handler import AuthHandler
|
from certbot._internal.auth_handler import AuthHandler
|
||||||
|
|
||||||
# Account is mocked...
|
# Account is mocked...
|
||||||
self.handler = AuthHandler(None, None, mock.Mock(key="mock_key"), [])
|
self.handler = AuthHandler(None, None, mock.Mock(key="mock_key"), [])
|
||||||
@@ -64,7 +64,7 @@ class HandleAuthorizationsTest(unittest.TestCase): # pylint: disable=too-many-p
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot.auth_handler import AuthHandler
|
from certbot._internal.auth_handler import AuthHandler
|
||||||
|
|
||||||
self.mock_display = mock.Mock()
|
self.mock_display = mock.Mock()
|
||||||
zope.component.provideUtility(
|
zope.component.provideUtility(
|
||||||
@@ -96,7 +96,7 @@ class HandleAuthorizationsTest(unittest.TestCase): # pylint: disable=too-many-p
|
|||||||
mock_order = mock.MagicMock(authorizations=[authzr])
|
mock_order = mock.MagicMock(authorizations=[authzr])
|
||||||
|
|
||||||
self.mock_net.poll.side_effect = _gen_mock_on_poll(retry=1, wait_value=30)
|
self.mock_net.poll.side_effect = _gen_mock_on_poll(retry=1, wait_value=30)
|
||||||
with mock.patch('certbot.auth_handler.time') as mock_time:
|
with mock.patch('certbot._internal.auth_handler.time') as mock_time:
|
||||||
authzr = self.handler.handle_authorizations(mock_order)
|
authzr = self.handler.handle_authorizations(mock_order)
|
||||||
|
|
||||||
self.assertEqual(self.mock_net.answer_challenge.call_count, 1)
|
self.assertEqual(self.mock_net.answer_challenge.call_count, 1)
|
||||||
@@ -326,7 +326,7 @@ class HandleAuthorizationsTest(unittest.TestCase): # pylint: disable=too-many-p
|
|||||||
|
|
||||||
mock_order = mock.MagicMock(authorizations=authzrs)
|
mock_order = mock.MagicMock(authorizations=authzrs)
|
||||||
|
|
||||||
with mock.patch('certbot.auth_handler._report_failed_authzrs') as mock_report:
|
with mock.patch('certbot._internal.auth_handler._report_failed_authzrs') as mock_report:
|
||||||
valid_authzr = self.handler.handle_authorizations(mock_order, True)
|
valid_authzr = self.handler.handle_authorizations(mock_order, True)
|
||||||
|
|
||||||
# Because best_effort=True, we did not blow up. Instead ...
|
# Because best_effort=True, we did not blow up. Instead ...
|
||||||
@@ -414,10 +414,10 @@ def _gen_mock_on_poll(status=messages.STATUS_VALID, retry=0, wait_value=1):
|
|||||||
|
|
||||||
|
|
||||||
class ChallbToAchallTest(unittest.TestCase):
|
class ChallbToAchallTest(unittest.TestCase):
|
||||||
"""Tests for certbot.auth_handler.challb_to_achall."""
|
"""Tests for certbot._internal.auth_handler.challb_to_achall."""
|
||||||
|
|
||||||
def _call(self, challb):
|
def _call(self, challb):
|
||||||
from certbot.auth_handler import challb_to_achall
|
from certbot._internal.auth_handler import challb_to_achall
|
||||||
return challb_to_achall(challb, "account_key", "domain")
|
return challb_to_achall(challb, "account_key", "domain")
|
||||||
|
|
||||||
def test_it(self):
|
def test_it(self):
|
||||||
@@ -430,7 +430,7 @@ class ChallbToAchallTest(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class GenChallengePathTest(unittest.TestCase):
|
class GenChallengePathTest(unittest.TestCase):
|
||||||
"""Tests for certbot.auth_handler.gen_challenge_path.
|
"""Tests for certbot._internal.auth_handler.gen_challenge_path.
|
||||||
|
|
||||||
.. todo:: Add more tests for dumb_path... depending on what we want to do.
|
.. todo:: Add more tests for dumb_path... depending on what we want to do.
|
||||||
|
|
||||||
@@ -443,7 +443,7 @@ class GenChallengePathTest(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _call(cls, challbs, preferences, combinations):
|
def _call(cls, challbs, preferences, combinations):
|
||||||
from certbot.auth_handler import gen_challenge_path
|
from certbot._internal.auth_handler import gen_challenge_path
|
||||||
return gen_challenge_path(challbs, preferences, combinations)
|
return gen_challenge_path(challbs, preferences, combinations)
|
||||||
|
|
||||||
def test_common_case(self):
|
def test_common_case(self):
|
||||||
@@ -473,7 +473,7 @@ class GenChallengePathTest(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class ReportFailedAuthzrsTest(unittest.TestCase):
|
class ReportFailedAuthzrsTest(unittest.TestCase):
|
||||||
"""Tests for certbot.auth_handler._report_failed_authzrs."""
|
"""Tests for certbot._internal.auth_handler._report_failed_authzrs."""
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -505,7 +505,7 @@ class ReportFailedAuthzrsTest(unittest.TestCase):
|
|||||||
|
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
def test_same_error_and_domain(self, mock_zope):
|
def test_same_error_and_domain(self, mock_zope):
|
||||||
from certbot import auth_handler
|
from certbot._internal import auth_handler
|
||||||
|
|
||||||
auth_handler._report_failed_authzrs([self.authzr1], 'key')
|
auth_handler._report_failed_authzrs([self.authzr1], 'key')
|
||||||
call_list = mock_zope().add_message.call_args_list
|
call_list = mock_zope().add_message.call_args_list
|
||||||
@@ -514,7 +514,7 @@ class ReportFailedAuthzrsTest(unittest.TestCase):
|
|||||||
|
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
def test_different_errors_and_domains(self, mock_zope):
|
def test_different_errors_and_domains(self, mock_zope):
|
||||||
from certbot import auth_handler
|
from certbot._internal import auth_handler
|
||||||
|
|
||||||
auth_handler._report_failed_authzrs([self.authzr1, self.authzr2], 'key')
|
auth_handler._report_failed_authzrs([self.authzr1, self.authzr2], 'key')
|
||||||
self.assertTrue(mock_zope().add_message.call_count == 2)
|
self.assertTrue(mock_zope().add_message.call_count == 2)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
"""Tests for certbot.cert_manager."""
|
"""Tests for certbot._internal.cert_manager."""
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
@@ -14,7 +14,7 @@ from certbot import errors
|
|||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.compat import filesystem
|
from certbot.compat import filesystem
|
||||||
from certbot.display import util as display_util
|
from certbot.display import util as display_util
|
||||||
from certbot.storage import ALL_FOUR
|
from certbot._internal.storage import ALL_FOUR
|
||||||
from certbot.tests import storage_test
|
from certbot.tests import storage_test
|
||||||
from certbot.tests import util as test_util
|
from certbot.tests import util as test_util
|
||||||
|
|
||||||
@@ -64,13 +64,13 @@ class BaseCertManagerTest(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class UpdateLiveSymlinksTest(BaseCertManagerTest):
|
class UpdateLiveSymlinksTest(BaseCertManagerTest):
|
||||||
"""Tests for certbot.cert_manager.update_live_symlinks
|
"""Tests for certbot._internal.cert_manager.update_live_symlinks
|
||||||
"""
|
"""
|
||||||
def test_update_live_symlinks(self):
|
def test_update_live_symlinks(self):
|
||||||
"""Test update_live_symlinks"""
|
"""Test update_live_symlinks"""
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
# create files with incorrect symlinks
|
# create files with incorrect symlinks
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
archive_paths = {}
|
archive_paths = {}
|
||||||
for domain in self.domains:
|
for domain in self.domains:
|
||||||
custom_archive = self.domains[domain]
|
custom_archive = self.domains[domain]
|
||||||
@@ -104,16 +104,16 @@ class UpdateLiveSymlinksTest(BaseCertManagerTest):
|
|||||||
|
|
||||||
|
|
||||||
class DeleteTest(storage_test.BaseRenewableCertTest):
|
class DeleteTest(storage_test.BaseRenewableCertTest):
|
||||||
"""Tests for certbot.cert_manager.delete
|
"""Tests for certbot._internal.cert_manager.delete
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _call(self):
|
def _call(self):
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
cert_manager.delete(self.config)
|
cert_manager.delete(self.config)
|
||||||
|
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
@mock.patch('certbot.cert_manager.lineage_for_certname')
|
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
|
||||||
@mock.patch('certbot.storage.delete_files')
|
@mock.patch('certbot._internal.storage.delete_files')
|
||||||
def test_delete_from_config(self, mock_delete_files, mock_lineage_for_certname,
|
def test_delete_from_config(self, mock_delete_files, mock_lineage_for_certname,
|
||||||
unused_get_utility):
|
unused_get_utility):
|
||||||
"""Test delete"""
|
"""Test delete"""
|
||||||
@@ -123,8 +123,8 @@ class DeleteTest(storage_test.BaseRenewableCertTest):
|
|||||||
mock_delete_files.assert_called_once_with(self.config, "example.org")
|
mock_delete_files.assert_called_once_with(self.config, "example.org")
|
||||||
|
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
@mock.patch('certbot.cert_manager.lineage_for_certname')
|
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
|
||||||
@mock.patch('certbot.storage.delete_files')
|
@mock.patch('certbot._internal.storage.delete_files')
|
||||||
def test_delete_interactive_single(self, mock_delete_files, mock_lineage_for_certname,
|
def test_delete_interactive_single(self, mock_delete_files, mock_lineage_for_certname,
|
||||||
mock_util):
|
mock_util):
|
||||||
"""Test delete"""
|
"""Test delete"""
|
||||||
@@ -134,8 +134,8 @@ class DeleteTest(storage_test.BaseRenewableCertTest):
|
|||||||
mock_delete_files.assert_called_once_with(self.config, "example.org")
|
mock_delete_files.assert_called_once_with(self.config, "example.org")
|
||||||
|
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
@mock.patch('certbot.cert_manager.lineage_for_certname')
|
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
|
||||||
@mock.patch('certbot.storage.delete_files')
|
@mock.patch('certbot._internal.storage.delete_files')
|
||||||
def test_delete_interactive_multiple(self, mock_delete_files, mock_lineage_for_certname,
|
def test_delete_interactive_multiple(self, mock_delete_files, mock_lineage_for_certname,
|
||||||
mock_util):
|
mock_util):
|
||||||
"""Test delete"""
|
"""Test delete"""
|
||||||
@@ -148,20 +148,20 @@ class DeleteTest(storage_test.BaseRenewableCertTest):
|
|||||||
|
|
||||||
|
|
||||||
class CertificatesTest(BaseCertManagerTest):
|
class CertificatesTest(BaseCertManagerTest):
|
||||||
"""Tests for certbot.cert_manager.certificates
|
"""Tests for certbot._internal.cert_manager.certificates
|
||||||
"""
|
"""
|
||||||
def _certificates(self, *args, **kwargs):
|
def _certificates(self, *args, **kwargs):
|
||||||
from certbot.cert_manager import certificates
|
from certbot._internal.cert_manager import certificates
|
||||||
return certificates(*args, **kwargs)
|
return certificates(*args, **kwargs)
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager.logger')
|
@mock.patch('certbot._internal.cert_manager.logger')
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
def test_certificates_parse_fail(self, mock_utility, mock_logger):
|
def test_certificates_parse_fail(self, mock_utility, mock_logger):
|
||||||
self._certificates(self.config)
|
self._certificates(self.config)
|
||||||
self.assertTrue(mock_logger.warning.called) #pylint: disable=no-member
|
self.assertTrue(mock_logger.warning.called) #pylint: disable=no-member
|
||||||
self.assertTrue(mock_utility.called)
|
self.assertTrue(mock_utility.called)
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager.logger')
|
@mock.patch('certbot._internal.cert_manager.logger')
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
def test_certificates_quiet(self, mock_utility, mock_logger):
|
def test_certificates_quiet(self, mock_utility, mock_logger):
|
||||||
self.config.quiet = True
|
self.config.quiet = True
|
||||||
@@ -170,10 +170,10 @@ class CertificatesTest(BaseCertManagerTest):
|
|||||||
self.assertTrue(mock_logger.warning.called) #pylint: disable=no-member
|
self.assertTrue(mock_logger.warning.called) #pylint: disable=no-member
|
||||||
|
|
||||||
@mock.patch('certbot.crypto_util.verify_renewable_cert')
|
@mock.patch('certbot.crypto_util.verify_renewable_cert')
|
||||||
@mock.patch('certbot.cert_manager.logger')
|
@mock.patch('certbot._internal.cert_manager.logger')
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
@mock.patch("certbot.storage.RenewableCert")
|
@mock.patch("certbot._internal.storage.RenewableCert")
|
||||||
@mock.patch('certbot.cert_manager._report_human_readable')
|
@mock.patch('certbot._internal.cert_manager._report_human_readable')
|
||||||
def test_certificates_parse_success(self, mock_report, mock_renewable_cert,
|
def test_certificates_parse_success(self, mock_report, mock_renewable_cert,
|
||||||
mock_utility, mock_logger, mock_verifier):
|
mock_utility, mock_logger, mock_verifier):
|
||||||
mock_verifier.return_value = None
|
mock_verifier.return_value = None
|
||||||
@@ -184,7 +184,7 @@ class CertificatesTest(BaseCertManagerTest):
|
|||||||
self.assertTrue(mock_utility.called)
|
self.assertTrue(mock_utility.called)
|
||||||
self.assertTrue(mock_renewable_cert.called)
|
self.assertTrue(mock_renewable_cert.called)
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager.logger')
|
@mock.patch('certbot._internal.cert_manager.logger')
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
def test_certificates_no_files(self, mock_utility, mock_logger):
|
def test_certificates_no_files(self, mock_utility, mock_logger):
|
||||||
empty_tempdir = tempfile.mkdtemp()
|
empty_tempdir = tempfile.mkdtemp()
|
||||||
@@ -201,10 +201,10 @@ class CertificatesTest(BaseCertManagerTest):
|
|||||||
self.assertTrue(mock_utility.called)
|
self.assertTrue(mock_utility.called)
|
||||||
shutil.rmtree(empty_tempdir)
|
shutil.rmtree(empty_tempdir)
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager.ocsp.RevocationChecker.ocsp_revoked')
|
@mock.patch('certbot._internal.cert_manager.ocsp.RevocationChecker.ocsp_revoked')
|
||||||
def test_report_human_readable(self, mock_revoked): #pylint: disable=too-many-statements
|
def test_report_human_readable(self, mock_revoked): #pylint: disable=too-many-statements
|
||||||
mock_revoked.return_value = None
|
mock_revoked.return_value = None
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
import datetime
|
import datetime
|
||||||
import pytz
|
import pytz
|
||||||
expiry = pytz.UTC.fromutc(datetime.datetime.utcnow())
|
expiry = pytz.UTC.fromutc(datetime.datetime.utcnow())
|
||||||
@@ -271,59 +271,59 @@ class CertificatesTest(BaseCertManagerTest):
|
|||||||
|
|
||||||
|
|
||||||
class SearchLineagesTest(BaseCertManagerTest):
|
class SearchLineagesTest(BaseCertManagerTest):
|
||||||
"""Tests for certbot.cert_manager._search_lineages."""
|
"""Tests for certbot._internal.cert_manager._search_lineages."""
|
||||||
|
|
||||||
@mock.patch('certbot.util.make_or_verify_dir')
|
@mock.patch('certbot.util.make_or_verify_dir')
|
||||||
@mock.patch('certbot.storage.renewal_conf_files')
|
@mock.patch('certbot._internal.storage.renewal_conf_files')
|
||||||
@mock.patch('certbot.storage.RenewableCert')
|
@mock.patch('certbot._internal.storage.RenewableCert')
|
||||||
def test_cert_storage_error(self, mock_renewable_cert, mock_renewal_conf_files,
|
def test_cert_storage_error(self, mock_renewable_cert, mock_renewal_conf_files,
|
||||||
mock_make_or_verify_dir):
|
mock_make_or_verify_dir):
|
||||||
mock_renewal_conf_files.return_value = ["badfile"]
|
mock_renewal_conf_files.return_value = ["badfile"]
|
||||||
mock_renewable_cert.side_effect = errors.CertStorageError
|
mock_renewable_cert.side_effect = errors.CertStorageError
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
self.assertEqual(cert_manager._search_lineages(self.config, lambda x: x, "check"), "check")
|
self.assertEqual(cert_manager._search_lineages(self.config, lambda x: x, "check"), "check")
|
||||||
self.assertTrue(mock_make_or_verify_dir.called)
|
self.assertTrue(mock_make_or_verify_dir.called)
|
||||||
|
|
||||||
|
|
||||||
class LineageForCertnameTest(BaseCertManagerTest):
|
class LineageForCertnameTest(BaseCertManagerTest):
|
||||||
"""Tests for certbot.cert_manager.lineage_for_certname"""
|
"""Tests for certbot._internal.cert_manager.lineage_for_certname"""
|
||||||
|
|
||||||
@mock.patch('certbot.util.make_or_verify_dir')
|
@mock.patch('certbot.util.make_or_verify_dir')
|
||||||
@mock.patch('certbot.storage.renewal_file_for_certname')
|
@mock.patch('certbot._internal.storage.renewal_file_for_certname')
|
||||||
@mock.patch('certbot.storage.RenewableCert')
|
@mock.patch('certbot._internal.storage.RenewableCert')
|
||||||
def test_found_match(self, mock_renewable_cert, mock_renewal_conf_file,
|
def test_found_match(self, mock_renewable_cert, mock_renewal_conf_file,
|
||||||
mock_make_or_verify_dir):
|
mock_make_or_verify_dir):
|
||||||
mock_renewal_conf_file.return_value = "somefile.conf"
|
mock_renewal_conf_file.return_value = "somefile.conf"
|
||||||
mock_match = mock.Mock(lineagename="example.com")
|
mock_match = mock.Mock(lineagename="example.com")
|
||||||
mock_renewable_cert.return_value = mock_match
|
mock_renewable_cert.return_value = mock_match
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
self.assertEqual(cert_manager.lineage_for_certname(self.config, "example.com"), mock_match)
|
self.assertEqual(cert_manager.lineage_for_certname(self.config, "example.com"), mock_match)
|
||||||
self.assertTrue(mock_make_or_verify_dir.called)
|
self.assertTrue(mock_make_or_verify_dir.called)
|
||||||
|
|
||||||
@mock.patch('certbot.util.make_or_verify_dir')
|
@mock.patch('certbot.util.make_or_verify_dir')
|
||||||
@mock.patch('certbot.storage.renewal_file_for_certname')
|
@mock.patch('certbot._internal.storage.renewal_file_for_certname')
|
||||||
def test_no_match(self, mock_renewal_conf_file, mock_make_or_verify_dir):
|
def test_no_match(self, mock_renewal_conf_file, mock_make_or_verify_dir):
|
||||||
mock_renewal_conf_file.return_value = "other.com.conf"
|
mock_renewal_conf_file.return_value = "other.com.conf"
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
self.assertEqual(cert_manager.lineage_for_certname(self.config, "example.com"), None)
|
self.assertEqual(cert_manager.lineage_for_certname(self.config, "example.com"), None)
|
||||||
self.assertTrue(mock_make_or_verify_dir.called)
|
self.assertTrue(mock_make_or_verify_dir.called)
|
||||||
|
|
||||||
@mock.patch('certbot.util.make_or_verify_dir')
|
@mock.patch('certbot.util.make_or_verify_dir')
|
||||||
@mock.patch('certbot.storage.renewal_file_for_certname')
|
@mock.patch('certbot._internal.storage.renewal_file_for_certname')
|
||||||
def test_no_renewal_file(self, mock_renewal_conf_file, mock_make_or_verify_dir):
|
def test_no_renewal_file(self, mock_renewal_conf_file, mock_make_or_verify_dir):
|
||||||
mock_renewal_conf_file.side_effect = errors.CertStorageError()
|
mock_renewal_conf_file.side_effect = errors.CertStorageError()
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
self.assertEqual(cert_manager.lineage_for_certname(self.config, "example.com"), None)
|
self.assertEqual(cert_manager.lineage_for_certname(self.config, "example.com"), None)
|
||||||
self.assertTrue(mock_make_or_verify_dir.called)
|
self.assertTrue(mock_make_or_verify_dir.called)
|
||||||
|
|
||||||
|
|
||||||
class DomainsForCertnameTest(BaseCertManagerTest):
|
class DomainsForCertnameTest(BaseCertManagerTest):
|
||||||
"""Tests for certbot.cert_manager.domains_for_certname"""
|
"""Tests for certbot._internal.cert_manager.domains_for_certname"""
|
||||||
|
|
||||||
@mock.patch('certbot.util.make_or_verify_dir')
|
@mock.patch('certbot.util.make_or_verify_dir')
|
||||||
@mock.patch('certbot.storage.renewal_file_for_certname')
|
@mock.patch('certbot._internal.storage.renewal_file_for_certname')
|
||||||
@mock.patch('certbot.storage.RenewableCert')
|
@mock.patch('certbot._internal.storage.RenewableCert')
|
||||||
def test_found_match(self, mock_renewable_cert, mock_renewal_conf_file,
|
def test_found_match(self, mock_renewable_cert, mock_renewal_conf_file,
|
||||||
mock_make_or_verify_dir):
|
mock_make_or_verify_dir):
|
||||||
mock_renewal_conf_file.return_value = "somefile.conf"
|
mock_renewal_conf_file.return_value = "somefile.conf"
|
||||||
@@ -331,22 +331,22 @@ class DomainsForCertnameTest(BaseCertManagerTest):
|
|||||||
domains = ["example.com", "example.org"]
|
domains = ["example.com", "example.org"]
|
||||||
mock_match.names.return_value = domains
|
mock_match.names.return_value = domains
|
||||||
mock_renewable_cert.return_value = mock_match
|
mock_renewable_cert.return_value = mock_match
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
self.assertEqual(cert_manager.domains_for_certname(self.config, "example.com"),
|
self.assertEqual(cert_manager.domains_for_certname(self.config, "example.com"),
|
||||||
domains)
|
domains)
|
||||||
self.assertTrue(mock_make_or_verify_dir.called)
|
self.assertTrue(mock_make_or_verify_dir.called)
|
||||||
|
|
||||||
@mock.patch('certbot.util.make_or_verify_dir')
|
@mock.patch('certbot.util.make_or_verify_dir')
|
||||||
@mock.patch('certbot.storage.renewal_file_for_certname')
|
@mock.patch('certbot._internal.storage.renewal_file_for_certname')
|
||||||
def test_no_match(self, mock_renewal_conf_file, mock_make_or_verify_dir):
|
def test_no_match(self, mock_renewal_conf_file, mock_make_or_verify_dir):
|
||||||
mock_renewal_conf_file.return_value = "somefile.conf"
|
mock_renewal_conf_file.return_value = "somefile.conf"
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
self.assertEqual(cert_manager.domains_for_certname(self.config, "other.com"), None)
|
self.assertEqual(cert_manager.domains_for_certname(self.config, "other.com"), None)
|
||||||
self.assertTrue(mock_make_or_verify_dir.called)
|
self.assertTrue(mock_make_or_verify_dir.called)
|
||||||
|
|
||||||
|
|
||||||
class RenameLineageTest(BaseCertManagerTest):
|
class RenameLineageTest(BaseCertManagerTest):
|
||||||
"""Tests for certbot.cert_manager.rename_lineage"""
|
"""Tests for certbot._internal.cert_manager.rename_lineage"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(RenameLineageTest, self).setUp()
|
super(RenameLineageTest, self).setUp()
|
||||||
@@ -354,10 +354,10 @@ class RenameLineageTest(BaseCertManagerTest):
|
|||||||
self.config.new_certname = "after"
|
self.config.new_certname = "after"
|
||||||
|
|
||||||
def _call(self, *args, **kwargs):
|
def _call(self, *args, **kwargs):
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
return cert_manager.rename_lineage(*args, **kwargs)
|
return cert_manager.rename_lineage(*args, **kwargs)
|
||||||
|
|
||||||
@mock.patch('certbot.storage.renewal_conf_files')
|
@mock.patch('certbot._internal.storage.renewal_conf_files')
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
def test_no_certname(self, mock_get_utility, mock_renewal_conf_files):
|
def test_no_certname(self, mock_get_utility, mock_renewal_conf_files):
|
||||||
self.config.certname = None
|
self.config.certname = None
|
||||||
@@ -388,7 +388,7 @@ class RenameLineageTest(BaseCertManagerTest):
|
|||||||
self.assertRaises(errors.Error, self._call, self.config)
|
self.assertRaises(errors.Error, self._call, self.config)
|
||||||
|
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
@mock.patch('certbot.cert_manager.lineage_for_certname')
|
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
|
||||||
def test_no_existing_certname(self, mock_lineage_for_certname, unused_get_utility):
|
def test_no_existing_certname(self, mock_lineage_for_certname, unused_get_utility):
|
||||||
self.config.certname = "one"
|
self.config.certname = "one"
|
||||||
self.config.new_certname = "two"
|
self.config.new_certname = "two"
|
||||||
@@ -397,30 +397,30 @@ class RenameLineageTest(BaseCertManagerTest):
|
|||||||
self._call, self.config)
|
self._call, self.config)
|
||||||
|
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
@mock.patch("certbot.storage.RenewableCert._check_symlinks")
|
@mock.patch("certbot._internal.storage.RenewableCert._check_symlinks")
|
||||||
def test_rename_cert(self, mock_check, unused_get_utility):
|
def test_rename_cert(self, mock_check, unused_get_utility):
|
||||||
mock_check.return_value = True
|
mock_check.return_value = True
|
||||||
self._call(self.config)
|
self._call(self.config)
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
updated_lineage = cert_manager.lineage_for_certname(self.config, self.config.new_certname)
|
updated_lineage = cert_manager.lineage_for_certname(self.config, self.config.new_certname)
|
||||||
self.assertTrue(updated_lineage is not None)
|
self.assertTrue(updated_lineage is not None)
|
||||||
self.assertEqual(updated_lineage.lineagename, self.config.new_certname)
|
self.assertEqual(updated_lineage.lineagename, self.config.new_certname)
|
||||||
|
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
@mock.patch("certbot.storage.RenewableCert._check_symlinks")
|
@mock.patch("certbot._internal.storage.RenewableCert._check_symlinks")
|
||||||
def test_rename_cert_interactive_certname(self, mock_check, mock_get_utility):
|
def test_rename_cert_interactive_certname(self, mock_check, mock_get_utility):
|
||||||
mock_check.return_value = True
|
mock_check.return_value = True
|
||||||
self.config.certname = None
|
self.config.certname = None
|
||||||
util_mock = mock_get_utility()
|
util_mock = mock_get_utility()
|
||||||
util_mock.menu.return_value = (display_util.OK, 0)
|
util_mock.menu.return_value = (display_util.OK, 0)
|
||||||
self._call(self.config)
|
self._call(self.config)
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
updated_lineage = cert_manager.lineage_for_certname(self.config, self.config.new_certname)
|
updated_lineage = cert_manager.lineage_for_certname(self.config, self.config.new_certname)
|
||||||
self.assertTrue(updated_lineage is not None)
|
self.assertTrue(updated_lineage is not None)
|
||||||
self.assertEqual(updated_lineage.lineagename, self.config.new_certname)
|
self.assertEqual(updated_lineage.lineagename, self.config.new_certname)
|
||||||
|
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
@mock.patch("certbot.storage.RenewableCert._check_symlinks")
|
@mock.patch("certbot._internal.storage.RenewableCert._check_symlinks")
|
||||||
def test_rename_cert_bad_new_certname(self, mock_check, unused_get_utility):
|
def test_rename_cert_bad_new_certname(self, mock_check, unused_get_utility):
|
||||||
mock_check.return_value = True
|
mock_check.return_value = True
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ class DuplicativeCertsTest(storage_test.BaseRenewableCertTest):
|
|||||||
|
|
||||||
@mock.patch('certbot.util.make_or_verify_dir')
|
@mock.patch('certbot.util.make_or_verify_dir')
|
||||||
def test_find_duplicative_names(self, unused_makedir):
|
def test_find_duplicative_names(self, unused_makedir):
|
||||||
from certbot.cert_manager import find_duplicative_certs
|
from certbot._internal.cert_manager import find_duplicative_certs
|
||||||
test_cert = test_util.load_vector('cert-san_512.pem')
|
test_cert = test_util.load_vector('cert-san_512.pem')
|
||||||
with open(self.test_rc.cert, 'wb') as f:
|
with open(self.test_rc.cert, 'wb') as f:
|
||||||
f.write(test_cert)
|
f.write(test_cert)
|
||||||
@@ -471,7 +471,7 @@ class DuplicativeCertsTest(storage_test.BaseRenewableCertTest):
|
|||||||
|
|
||||||
|
|
||||||
class CertPathToLineageTest(storage_test.BaseRenewableCertTest):
|
class CertPathToLineageTest(storage_test.BaseRenewableCertTest):
|
||||||
"""Tests for certbot.cert_manager.cert_path_to_lineage"""
|
"""Tests for certbot._internal.cert_manager.cert_path_to_lineage"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(CertPathToLineageTest, self).setUp()
|
super(CertPathToLineageTest, self).setUp()
|
||||||
@@ -482,11 +482,11 @@ class CertPathToLineageTest(storage_test.BaseRenewableCertTest):
|
|||||||
self.config.cert_path = (self.fullchain, '')
|
self.config.cert_path = (self.fullchain, '')
|
||||||
|
|
||||||
def _call(self, cli_config):
|
def _call(self, cli_config):
|
||||||
from certbot.cert_manager import cert_path_to_lineage
|
from certbot._internal.cert_manager import cert_path_to_lineage
|
||||||
return cert_path_to_lineage(cli_config)
|
return cert_path_to_lineage(cli_config)
|
||||||
|
|
||||||
def _archive_files(self, cli_config, filetype):
|
def _archive_files(self, cli_config, filetype):
|
||||||
from certbot.cert_manager import _archive_files
|
from certbot._internal.cert_manager import _archive_files
|
||||||
return _archive_files(cli_config, filetype)
|
return _archive_files(cli_config, filetype)
|
||||||
|
|
||||||
def test_basic_match(self):
|
def test_basic_match(self):
|
||||||
@@ -498,13 +498,13 @@ class CertPathToLineageTest(storage_test.BaseRenewableCertTest):
|
|||||||
'SailorMoon', 'fullchain.pem')
|
'SailorMoon', 'fullchain.pem')
|
||||||
self.assertRaises(errors.Error, self._call, bad_test_config)
|
self.assertRaises(errors.Error, self._call, bad_test_config)
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager._acceptable_matches')
|
@mock.patch('certbot._internal.cert_manager._acceptable_matches')
|
||||||
def test_options_fullchain(self, mock_acceptable_matches):
|
def test_options_fullchain(self, mock_acceptable_matches):
|
||||||
mock_acceptable_matches.return_value = [lambda x: x.fullchain_path]
|
mock_acceptable_matches.return_value = [lambda x: x.fullchain_path]
|
||||||
self.config.fullchain_path = self.fullchain
|
self.config.fullchain_path = self.fullchain
|
||||||
self.assertEqual('example.org', self._call(self.config))
|
self.assertEqual('example.org', self._call(self.config))
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager._acceptable_matches')
|
@mock.patch('certbot._internal.cert_manager._acceptable_matches')
|
||||||
def test_options_cert_path(self, mock_acceptable_matches):
|
def test_options_cert_path(self, mock_acceptable_matches):
|
||||||
mock_acceptable_matches.return_value = [lambda x: x.cert_path]
|
mock_acceptable_matches.return_value = [lambda x: x.cert_path]
|
||||||
test_cert_path = os.path.join(self.config.config_dir, 'live', 'example.org',
|
test_cert_path = os.path.join(self.config.config_dir, 'live', 'example.org',
|
||||||
@@ -512,7 +512,7 @@ class CertPathToLineageTest(storage_test.BaseRenewableCertTest):
|
|||||||
self.config.cert_path = (test_cert_path, '')
|
self.config.cert_path = (test_cert_path, '')
|
||||||
self.assertEqual('example.org', self._call(self.config))
|
self.assertEqual('example.org', self._call(self.config))
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager._acceptable_matches')
|
@mock.patch('certbot._internal.cert_manager._acceptable_matches')
|
||||||
def test_options_archive_cert(self, mock_acceptable_matches):
|
def test_options_archive_cert(self, mock_acceptable_matches):
|
||||||
# Also this and the next test check that the regex of _archive_files is working.
|
# Also this and the next test check that the regex of _archive_files is working.
|
||||||
self.config.cert_path = (os.path.join(self.config.config_dir, 'archive', 'example.org',
|
self.config.cert_path = (os.path.join(self.config.config_dir, 'archive', 'example.org',
|
||||||
@@ -520,7 +520,7 @@ class CertPathToLineageTest(storage_test.BaseRenewableCertTest):
|
|||||||
mock_acceptable_matches.return_value = [lambda x: self._archive_files(x, 'cert')]
|
mock_acceptable_matches.return_value = [lambda x: self._archive_files(x, 'cert')]
|
||||||
self.assertEqual('example.org', self._call(self.config))
|
self.assertEqual('example.org', self._call(self.config))
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager._acceptable_matches')
|
@mock.patch('certbot._internal.cert_manager._acceptable_matches')
|
||||||
def test_options_archive_fullchain(self, mock_acceptable_matches):
|
def test_options_archive_fullchain(self, mock_acceptable_matches):
|
||||||
self.config.cert_path = (os.path.join(self.config.config_dir, 'archive',
|
self.config.cert_path = (os.path.join(self.config.config_dir, 'archive',
|
||||||
'example.org', 'fullchain11.pem'), '')
|
'example.org', 'fullchain11.pem'), '')
|
||||||
@@ -530,7 +530,8 @@ class CertPathToLineageTest(storage_test.BaseRenewableCertTest):
|
|||||||
|
|
||||||
|
|
||||||
class MatchAndCheckOverlaps(storage_test.BaseRenewableCertTest):
|
class MatchAndCheckOverlaps(storage_test.BaseRenewableCertTest):
|
||||||
"""Tests for certbot.cert_manager.match_and_check_overlaps w/o overlapping archive dirs."""
|
"""Tests for certbot._internal.cert_manager.match_and_check_overlaps w/o overlapping
|
||||||
|
archive dirs."""
|
||||||
# A test with real overlapping archive dirs can be found in tests/boulder_integration.sh
|
# A test with real overlapping archive dirs can be found in tests/boulder_integration.sh
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(MatchAndCheckOverlaps, self).setUp()
|
super(MatchAndCheckOverlaps, self).setUp()
|
||||||
@@ -541,27 +542,27 @@ class MatchAndCheckOverlaps(storage_test.BaseRenewableCertTest):
|
|||||||
self.config.cert_path = (self.fullchain, '')
|
self.config.cert_path = (self.fullchain, '')
|
||||||
|
|
||||||
def _call(self, cli_config, acceptable_matches, match_func, rv_func):
|
def _call(self, cli_config, acceptable_matches, match_func, rv_func):
|
||||||
from certbot.cert_manager import match_and_check_overlaps
|
from certbot._internal.cert_manager import match_and_check_overlaps
|
||||||
return match_and_check_overlaps(cli_config, acceptable_matches, match_func, rv_func)
|
return match_and_check_overlaps(cli_config, acceptable_matches, match_func, rv_func)
|
||||||
|
|
||||||
def test_basic_match(self):
|
def test_basic_match(self):
|
||||||
from certbot.cert_manager import _acceptable_matches
|
from certbot._internal.cert_manager import _acceptable_matches
|
||||||
self.assertEqual(['example.org'], self._call(self.config, _acceptable_matches(),
|
self.assertEqual(['example.org'], self._call(self.config, _acceptable_matches(),
|
||||||
lambda x: self.config.cert_path[0], lambda x: x.lineagename))
|
lambda x: self.config.cert_path[0], lambda x: x.lineagename))
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager._search_lineages')
|
@mock.patch('certbot._internal.cert_manager._search_lineages')
|
||||||
def test_no_matches(self, mock_search_lineages):
|
def test_no_matches(self, mock_search_lineages):
|
||||||
mock_search_lineages.return_value = []
|
mock_search_lineages.return_value = []
|
||||||
self.assertRaises(errors.Error, self._call, self.config, None, None, None)
|
self.assertRaises(errors.Error, self._call, self.config, None, None, None)
|
||||||
|
|
||||||
@mock.patch('certbot.cert_manager._search_lineages')
|
@mock.patch('certbot._internal.cert_manager._search_lineages')
|
||||||
def test_too_many_matches(self, mock_search_lineages):
|
def test_too_many_matches(self, mock_search_lineages):
|
||||||
mock_search_lineages.return_value = ['spider', 'dance']
|
mock_search_lineages.return_value = ['spider', 'dance']
|
||||||
self.assertRaises(errors.OverlappingMatchFound, self._call, self.config, None, None, None)
|
self.assertRaises(errors.OverlappingMatchFound, self._call, self.config, None, None, None)
|
||||||
|
|
||||||
|
|
||||||
class GetCertnameTest(unittest.TestCase):
|
class GetCertnameTest(unittest.TestCase):
|
||||||
"""Tests for certbot.cert_manager."""
|
"""Tests for certbot._internal.cert_manager."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.get_utility_patch = test_util.patch_get_utility()
|
self.get_utility_patch = test_util.patch_get_utility()
|
||||||
@@ -572,12 +573,12 @@ class GetCertnameTest(unittest.TestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.get_utility_patch.stop()
|
self.get_utility_patch.stop()
|
||||||
|
|
||||||
@mock.patch('certbot.storage.renewal_conf_files')
|
@mock.patch('certbot._internal.storage.renewal_conf_files')
|
||||||
@mock.patch('certbot.storage.lineagename_for_filename')
|
@mock.patch('certbot._internal.storage.lineagename_for_filename')
|
||||||
def test_get_certnames(self, mock_name, mock_files):
|
def test_get_certnames(self, mock_name, mock_files):
|
||||||
mock_files.return_value = ['example.com.conf']
|
mock_files.return_value = ['example.com.conf']
|
||||||
mock_name.return_value = 'example.com'
|
mock_name.return_value = 'example.com'
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
prompt = "Which certificate would you"
|
prompt = "Which certificate would you"
|
||||||
self.mock_get_utility().menu.return_value = (display_util.OK, 0)
|
self.mock_get_utility().menu.return_value = (display_util.OK, 0)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@@ -586,12 +587,12 @@ class GetCertnameTest(unittest.TestCase):
|
|||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
prompt in self.mock_get_utility().menu.call_args[0][0])
|
prompt in self.mock_get_utility().menu.call_args[0][0])
|
||||||
|
|
||||||
@mock.patch('certbot.storage.renewal_conf_files')
|
@mock.patch('certbot._internal.storage.renewal_conf_files')
|
||||||
@mock.patch('certbot.storage.lineagename_for_filename')
|
@mock.patch('certbot._internal.storage.lineagename_for_filename')
|
||||||
def test_get_certnames_custom_prompt(self, mock_name, mock_files):
|
def test_get_certnames_custom_prompt(self, mock_name, mock_files):
|
||||||
mock_files.return_value = ['example.com.conf']
|
mock_files.return_value = ['example.com.conf']
|
||||||
mock_name.return_value = 'example.com'
|
mock_name.return_value = 'example.com'
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
prompt = "custom prompt"
|
prompt = "custom prompt"
|
||||||
self.mock_get_utility().menu.return_value = (display_util.OK, 0)
|
self.mock_get_utility().menu.return_value = (display_util.OK, 0)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@@ -601,24 +602,24 @@ class GetCertnameTest(unittest.TestCase):
|
|||||||
self.assertEqual(self.mock_get_utility().menu.call_args[0][0],
|
self.assertEqual(self.mock_get_utility().menu.call_args[0][0],
|
||||||
prompt)
|
prompt)
|
||||||
|
|
||||||
@mock.patch('certbot.storage.renewal_conf_files')
|
@mock.patch('certbot._internal.storage.renewal_conf_files')
|
||||||
@mock.patch('certbot.storage.lineagename_for_filename')
|
@mock.patch('certbot._internal.storage.lineagename_for_filename')
|
||||||
def test_get_certnames_user_abort(self, mock_name, mock_files):
|
def test_get_certnames_user_abort(self, mock_name, mock_files):
|
||||||
mock_files.return_value = ['example.com.conf']
|
mock_files.return_value = ['example.com.conf']
|
||||||
mock_name.return_value = 'example.com'
|
mock_name.return_value = 'example.com'
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
self.mock_get_utility().menu.return_value = (display_util.CANCEL, 0)
|
self.mock_get_utility().menu.return_value = (display_util.CANCEL, 0)
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
errors.Error,
|
errors.Error,
|
||||||
cert_manager.get_certnames,
|
cert_manager.get_certnames,
|
||||||
self.config, "erroring_anyway", allow_multiple=False)
|
self.config, "erroring_anyway", allow_multiple=False)
|
||||||
|
|
||||||
@mock.patch('certbot.storage.renewal_conf_files')
|
@mock.patch('certbot._internal.storage.renewal_conf_files')
|
||||||
@mock.patch('certbot.storage.lineagename_for_filename')
|
@mock.patch('certbot._internal.storage.lineagename_for_filename')
|
||||||
def test_get_certnames_allow_multiple(self, mock_name, mock_files):
|
def test_get_certnames_allow_multiple(self, mock_name, mock_files):
|
||||||
mock_files.return_value = ['example.com.conf']
|
mock_files.return_value = ['example.com.conf']
|
||||||
mock_name.return_value = 'example.com'
|
mock_name.return_value = 'example.com'
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
prompt = "Which certificate(s) would you"
|
prompt = "Which certificate(s) would you"
|
||||||
self.mock_get_utility().checklist.return_value = (display_util.OK,
|
self.mock_get_utility().checklist.return_value = (display_util.OK,
|
||||||
['example.com'])
|
['example.com'])
|
||||||
@@ -628,12 +629,12 @@ class GetCertnameTest(unittest.TestCase):
|
|||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
prompt in self.mock_get_utility().checklist.call_args[0][0])
|
prompt in self.mock_get_utility().checklist.call_args[0][0])
|
||||||
|
|
||||||
@mock.patch('certbot.storage.renewal_conf_files')
|
@mock.patch('certbot._internal.storage.renewal_conf_files')
|
||||||
@mock.patch('certbot.storage.lineagename_for_filename')
|
@mock.patch('certbot._internal.storage.lineagename_for_filename')
|
||||||
def test_get_certnames_allow_multiple_custom_prompt(self, mock_name, mock_files):
|
def test_get_certnames_allow_multiple_custom_prompt(self, mock_name, mock_files):
|
||||||
mock_files.return_value = ['example.com.conf']
|
mock_files.return_value = ['example.com.conf']
|
||||||
mock_name.return_value = 'example.com'
|
mock_name.return_value = 'example.com'
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
prompt = "custom prompt"
|
prompt = "custom prompt"
|
||||||
self.mock_get_utility().checklist.return_value = (display_util.OK,
|
self.mock_get_utility().checklist.return_value = (display_util.OK,
|
||||||
['example.com'])
|
['example.com'])
|
||||||
@@ -645,12 +646,12 @@ class GetCertnameTest(unittest.TestCase):
|
|||||||
self.mock_get_utility().checklist.call_args[0][0],
|
self.mock_get_utility().checklist.call_args[0][0],
|
||||||
prompt)
|
prompt)
|
||||||
|
|
||||||
@mock.patch('certbot.storage.renewal_conf_files')
|
@mock.patch('certbot._internal.storage.renewal_conf_files')
|
||||||
@mock.patch('certbot.storage.lineagename_for_filename')
|
@mock.patch('certbot._internal.storage.lineagename_for_filename')
|
||||||
def test_get_certnames_allow_multiple_user_abort(self, mock_name, mock_files):
|
def test_get_certnames_allow_multiple_user_abort(self, mock_name, mock_files):
|
||||||
mock_files.return_value = ['example.com.conf']
|
mock_files.return_value = ['example.com.conf']
|
||||||
mock_name.return_value = 'example.com'
|
mock_name.return_value = 'example.com'
|
||||||
from certbot import cert_manager
|
from certbot._internal import cert_manager
|
||||||
self.mock_get_utility().checklist.return_value = (display_util.CANCEL, [])
|
self.mock_get_utility().checklist.return_value = (display_util.CANCEL, [])
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
errors.Error,
|
errors.Error,
|
||||||
|
@@ -86,10 +86,10 @@ class ParseTest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
|||||||
def write_msg(message, *args, **kwargs): # pylint: disable=missing-docstring,unused-argument
|
def write_msg(message, *args, **kwargs): # pylint: disable=missing-docstring,unused-argument
|
||||||
output.write(message)
|
output.write(message)
|
||||||
|
|
||||||
with mock.patch('certbot.main.sys.stdout', new=output):
|
with mock.patch('certbot._internal.main.sys.stdout', new=output):
|
||||||
with test_util.patch_get_utility() as mock_get_utility:
|
with test_util.patch_get_utility() as mock_get_utility:
|
||||||
mock_get_utility().notification.side_effect = write_msg
|
mock_get_utility().notification.side_effect = write_msg
|
||||||
with mock.patch('certbot.main.sys.stderr'):
|
with mock.patch('certbot._internal.main.sys.stderr'):
|
||||||
self.assertRaises(SystemExit, self._unmocked_parse, args, output)
|
self.assertRaises(SystemExit, self._unmocked_parse, args, output)
|
||||||
|
|
||||||
return output.getvalue()
|
return output.getvalue()
|
||||||
@@ -126,7 +126,7 @@ class ParseTest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
|||||||
chain = 'chain'
|
chain = 'chain'
|
||||||
fullchain = 'fullchain'
|
fullchain = 'fullchain'
|
||||||
|
|
||||||
with mock.patch('certbot.main.install'):
|
with mock.patch('certbot._internal.main.install'):
|
||||||
namespace = self.parse(['install', '--cert-path', cert,
|
namespace = self.parse(['install', '--cert-path', cert,
|
||||||
'--key-path', 'key', '--chain-path',
|
'--key-path', 'key', '--chain-path',
|
||||||
'chain', '--fullchain-path', 'fullchain'])
|
'chain', '--fullchain-path', 'fullchain'])
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
"""Tests for certbot.client."""
|
"""Tests for certbot._internal.client."""
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -9,7 +9,7 @@ import mock
|
|||||||
from josepy import interfaces
|
from josepy import interfaces
|
||||||
|
|
||||||
import certbot.tests.util as test_util
|
import certbot.tests.util as test_util
|
||||||
from certbot import account
|
from certbot._internal import account
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.compat import filesystem
|
from certbot.compat import filesystem
|
||||||
@@ -18,12 +18,13 @@ from certbot import util
|
|||||||
KEY = test_util.load_vector("rsa512_key.pem")
|
KEY = test_util.load_vector("rsa512_key.pem")
|
||||||
CSR_SAN = test_util.load_vector("csr-san_512.pem")
|
CSR_SAN = test_util.load_vector("csr-san_512.pem")
|
||||||
|
|
||||||
|
# pylint: disable=line-too-long
|
||||||
|
|
||||||
class DetermineUserAgentTest(test_util.ConfigTestCase):
|
class DetermineUserAgentTest(test_util.ConfigTestCase):
|
||||||
"""Tests for certbot.client.determine_user_agent."""
|
"""Tests for certbot._internal.client.determine_user_agent."""
|
||||||
|
|
||||||
def _call(self):
|
def _call(self):
|
||||||
from certbot.client import determine_user_agent
|
from certbot._internal.client import determine_user_agent
|
||||||
return determine_user_agent(self.config)
|
return determine_user_agent(self.config)
|
||||||
|
|
||||||
@mock.patch.dict(os.environ, {"CERTBOT_DOCS": "1"})
|
@mock.patch.dict(os.environ, {"CERTBOT_DOCS": "1"})
|
||||||
@@ -52,7 +53,7 @@ class DetermineUserAgentTest(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class RegisterTest(test_util.ConfigTestCase):
|
class RegisterTest(test_util.ConfigTestCase):
|
||||||
"""Tests for certbot.client.register."""
|
"""Tests for certbot._internal.client.register."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(RegisterTest, self).setUp()
|
super(RegisterTest, self).setUp()
|
||||||
@@ -62,7 +63,7 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
self.account_storage = account.AccountMemoryStorage()
|
self.account_storage = account.AccountMemoryStorage()
|
||||||
|
|
||||||
def _call(self):
|
def _call(self):
|
||||||
from certbot.client import register
|
from certbot._internal.client import register
|
||||||
tos_cb = mock.MagicMock()
|
tos_cb = mock.MagicMock()
|
||||||
return register(self.config, self.account_storage, tos_cb)
|
return register(self.config, self.account_storage, tos_cb)
|
||||||
|
|
||||||
@@ -85,11 +86,11 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def test_no_tos(self):
|
def test_no_tos(self):
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
||||||
mock_client.new_account_and_tos().terms_of_service = "http://tos"
|
mock_client.new_account_and_tos().terms_of_service = "http://tos"
|
||||||
mock_client().external_account_required.side_effect = self._false_mock
|
mock_client().external_account_required.side_effect = self._false_mock
|
||||||
with mock.patch("certbot.eff.handle_subscription") as mock_handle:
|
with mock.patch("certbot.eff.handle_subscription") as mock_handle:
|
||||||
with mock.patch("certbot.account.report_new_account"):
|
with mock.patch("certbot._internal.account.report_new_account"):
|
||||||
mock_client().new_account_and_tos.side_effect = errors.Error
|
mock_client().new_account_and_tos.side_effect = errors.Error
|
||||||
self.assertRaises(errors.Error, self._call)
|
self.assertRaises(errors.Error, self._call)
|
||||||
self.assertFalse(mock_handle.called)
|
self.assertFalse(mock_handle.called)
|
||||||
@@ -99,20 +100,20 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
self.assertTrue(mock_handle.called)
|
self.assertTrue(mock_handle.called)
|
||||||
|
|
||||||
def test_it(self):
|
def test_it(self):
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
||||||
mock_client().external_account_required.side_effect = self._false_mock
|
mock_client().external_account_required.side_effect = self._false_mock
|
||||||
with mock.patch("certbot.account.report_new_account"):
|
with mock.patch("certbot._internal.account.report_new_account"):
|
||||||
with mock.patch("certbot.eff.handle_subscription"):
|
with mock.patch("certbot.eff.handle_subscription"):
|
||||||
self._call()
|
self._call()
|
||||||
|
|
||||||
@mock.patch("certbot.account.report_new_account")
|
@mock.patch("certbot._internal.account.report_new_account")
|
||||||
@mock.patch("certbot.client.display_ops.get_email")
|
@mock.patch("certbot._internal.client.display_ops.get_email")
|
||||||
def test_email_retry(self, _rep, mock_get_email):
|
def test_email_retry(self, _rep, mock_get_email):
|
||||||
from acme import messages
|
from acme import messages
|
||||||
self.config.noninteractive_mode = False
|
self.config.noninteractive_mode = False
|
||||||
msg = "DNS problem: NXDOMAIN looking up MX for example.com"
|
msg = "DNS problem: NXDOMAIN looking up MX for example.com"
|
||||||
mx_err = messages.Error.with_code('invalidContact', detail=msg)
|
mx_err = messages.Error.with_code('invalidContact', detail=msg)
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
||||||
mock_client().external_account_required.side_effect = self._false_mock
|
mock_client().external_account_required.side_effect = self._false_mock
|
||||||
with mock.patch("certbot.eff.handle_subscription") as mock_handle:
|
with mock.patch("certbot.eff.handle_subscription") as mock_handle:
|
||||||
mock_client().new_account_and_tos.side_effect = [mx_err, mock.MagicMock()]
|
mock_client().new_account_and_tos.side_effect = [mx_err, mock.MagicMock()]
|
||||||
@@ -120,13 +121,13 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
self.assertEqual(mock_get_email.call_count, 1)
|
self.assertEqual(mock_get_email.call_count, 1)
|
||||||
self.assertTrue(mock_handle.called)
|
self.assertTrue(mock_handle.called)
|
||||||
|
|
||||||
@mock.patch("certbot.account.report_new_account")
|
@mock.patch("certbot._internal.account.report_new_account")
|
||||||
def test_email_invalid_noninteractive(self, _rep):
|
def test_email_invalid_noninteractive(self, _rep):
|
||||||
from acme import messages
|
from acme import messages
|
||||||
self.config.noninteractive_mode = True
|
self.config.noninteractive_mode = True
|
||||||
msg = "DNS problem: NXDOMAIN looking up MX for example.com"
|
msg = "DNS problem: NXDOMAIN looking up MX for example.com"
|
||||||
mx_err = messages.Error.with_code('invalidContact', detail=msg)
|
mx_err = messages.Error.with_code('invalidContact', detail=msg)
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
||||||
mock_client().external_account_required.side_effect = self._false_mock
|
mock_client().external_account_required.side_effect = self._false_mock
|
||||||
with mock.patch("certbot.eff.handle_subscription"):
|
with mock.patch("certbot.eff.handle_subscription"):
|
||||||
mock_client().new_account_and_tos.side_effect = [mx_err, mock.MagicMock()]
|
mock_client().new_account_and_tos.side_effect = [mx_err, mock.MagicMock()]
|
||||||
@@ -136,12 +137,12 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
self.config.email = None
|
self.config.email = None
|
||||||
self.assertRaises(errors.Error, self._call)
|
self.assertRaises(errors.Error, self._call)
|
||||||
|
|
||||||
@mock.patch("certbot.client.logger")
|
@mock.patch("certbot._internal.client.logger")
|
||||||
def test_without_email(self, mock_logger):
|
def test_without_email(self, mock_logger):
|
||||||
with mock.patch("certbot.eff.handle_subscription") as mock_handle:
|
with mock.patch("certbot.eff.handle_subscription") as mock_handle:
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_clnt:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_clnt:
|
||||||
mock_clnt().external_account_required.side_effect = self._false_mock
|
mock_clnt().external_account_required.side_effect = self._false_mock
|
||||||
with mock.patch("certbot.account.report_new_account"):
|
with mock.patch("certbot._internal.account.report_new_account"):
|
||||||
self.config.email = None
|
self.config.email = None
|
||||||
self.config.register_unsafely_without_email = True
|
self.config.register_unsafely_without_email = True
|
||||||
self.config.dry_run = False
|
self.config.dry_run = False
|
||||||
@@ -149,14 +150,14 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
mock_logger.info.assert_called_once_with(mock.ANY)
|
mock_logger.info.assert_called_once_with(mock.ANY)
|
||||||
self.assertTrue(mock_handle.called)
|
self.assertTrue(mock_handle.called)
|
||||||
|
|
||||||
@mock.patch("certbot.account.report_new_account")
|
@mock.patch("certbot._internal.account.report_new_account")
|
||||||
@mock.patch("certbot.client.display_ops.get_email")
|
@mock.patch("certbot._internal.client.display_ops.get_email")
|
||||||
def test_dry_run_no_staging_account(self, _rep, mock_get_email):
|
def test_dry_run_no_staging_account(self, _rep, mock_get_email):
|
||||||
"""Tests dry-run for no staging account, expect account created with no email"""
|
"""Tests dry-run for no staging account, expect account created with no email"""
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
||||||
mock_client().external_account_required.side_effect = self._false_mock
|
mock_client().external_account_required.side_effect = self._false_mock
|
||||||
with mock.patch("certbot.eff.handle_subscription"):
|
with mock.patch("certbot.eff.handle_subscription"):
|
||||||
with mock.patch("certbot.account.report_new_account"):
|
with mock.patch("certbot._internal.account.report_new_account"):
|
||||||
self.config.dry_run = True
|
self.config.dry_run = True
|
||||||
self._call()
|
self._call()
|
||||||
# check Certbot did not ask the user to provide an email
|
# check Certbot did not ask the user to provide an email
|
||||||
@@ -165,13 +166,13 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
self.assertFalse(mock_client().new_account_and_tos.call_args[0][0].contact)
|
self.assertFalse(mock_client().new_account_and_tos.call_args[0][0].contact)
|
||||||
|
|
||||||
def test_with_eab_arguments(self):
|
def test_with_eab_arguments(self):
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
||||||
mock_client().client.directory.__getitem__ = mock.Mock(
|
mock_client().client.directory.__getitem__ = mock.Mock(
|
||||||
side_effect=self._new_acct_dir_mock
|
side_effect=self._new_acct_dir_mock
|
||||||
)
|
)
|
||||||
mock_client().external_account_required.side_effect = self._false_mock
|
mock_client().external_account_required.side_effect = self._false_mock
|
||||||
with mock.patch("certbot.eff.handle_subscription"):
|
with mock.patch("certbot.eff.handle_subscription"):
|
||||||
target = "certbot.client.messages.ExternalAccountBinding.from_data"
|
target = "certbot._internal.client.messages.ExternalAccountBinding.from_data"
|
||||||
with mock.patch(target) as mock_eab_from_data:
|
with mock.patch(target) as mock_eab_from_data:
|
||||||
self.config.eab_kid = "test-kid"
|
self.config.eab_kid = "test-kid"
|
||||||
self.config.eab_hmac_key = "J2OAqW4MHXsrHVa_PVg0Y-L_R4SYw0_aL1le6mfblbE"
|
self.config.eab_hmac_key = "J2OAqW4MHXsrHVa_PVg0Y-L_R4SYw0_aL1le6mfblbE"
|
||||||
@@ -180,10 +181,10 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
self.assertTrue(mock_eab_from_data.called)
|
self.assertTrue(mock_eab_from_data.called)
|
||||||
|
|
||||||
def test_without_eab_arguments(self):
|
def test_without_eab_arguments(self):
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
||||||
mock_client().external_account_required.side_effect = self._false_mock
|
mock_client().external_account_required.side_effect = self._false_mock
|
||||||
with mock.patch("certbot.eff.handle_subscription"):
|
with mock.patch("certbot.eff.handle_subscription"):
|
||||||
target = "certbot.client.messages.ExternalAccountBinding.from_data"
|
target = "certbot._internal.client.messages.ExternalAccountBinding.from_data"
|
||||||
with mock.patch(target) as mock_eab_from_data:
|
with mock.patch(target) as mock_eab_from_data:
|
||||||
self.config.eab_kid = None
|
self.config.eab_kid = None
|
||||||
self.config.eab_hmac_key = None
|
self.config.eab_hmac_key = None
|
||||||
@@ -192,11 +193,11 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
self.assertFalse(mock_eab_from_data.called)
|
self.assertFalse(mock_eab_from_data.called)
|
||||||
|
|
||||||
def test_external_account_required_without_eab_arguments(self):
|
def test_external_account_required_without_eab_arguments(self):
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
||||||
mock_client().client.net.key.public_key = mock.Mock(side_effect=self._public_key_mock)
|
mock_client().client.net.key.public_key = mock.Mock(side_effect=self._public_key_mock)
|
||||||
mock_client().external_account_required.side_effect = self._true_mock
|
mock_client().external_account_required.side_effect = self._true_mock
|
||||||
with mock.patch("certbot.eff.handle_subscription"):
|
with mock.patch("certbot.eff.handle_subscription"):
|
||||||
with mock.patch("certbot.client.messages.ExternalAccountBinding.from_data"):
|
with mock.patch("certbot._internal.client.messages.ExternalAccountBinding.from_data"):
|
||||||
self.config.eab_kid = None
|
self.config.eab_kid = None
|
||||||
self.config.eab_hmac_key = None
|
self.config.eab_hmac_key = None
|
||||||
|
|
||||||
@@ -206,7 +207,7 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
from acme import messages
|
from acme import messages
|
||||||
msg = "Test"
|
msg = "Test"
|
||||||
mx_err = messages.Error(detail=msg, typ="malformed", title="title")
|
mx_err = messages.Error(detail=msg, typ="malformed", title="title")
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as mock_client:
|
||||||
mock_client().client.directory.__getitem__ = mock.Mock(
|
mock_client().client.directory.__getitem__ = mock.Mock(
|
||||||
side_effect=self._new_acct_dir_mock
|
side_effect=self._new_acct_dir_mock
|
||||||
)
|
)
|
||||||
@@ -218,7 +219,7 @@ class RegisterTest(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class ClientTestCommon(test_util.ConfigTestCase):
|
class ClientTestCommon(test_util.ConfigTestCase):
|
||||||
"""Common base class for certbot.client.Client tests."""
|
"""Common base class for certbot._internal.client.Client tests."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ClientTestCommon, self).setUp()
|
super(ClientTestCommon, self).setUp()
|
||||||
@@ -227,8 +228,8 @@ class ClientTestCommon(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
self.account = mock.MagicMock(**{"key.pem": KEY})
|
self.account = mock.MagicMock(**{"key.pem": KEY})
|
||||||
|
|
||||||
from certbot.client import Client
|
from certbot._internal.client import Client
|
||||||
with mock.patch("certbot.client.acme_client.BackwardsCompatibleClientV2") as acme:
|
with mock.patch("certbot._internal.client.acme_client.BackwardsCompatibleClientV2") as acme:
|
||||||
self.acme_client = acme
|
self.acme_client = acme
|
||||||
self.acme = acme.return_value = mock.MagicMock()
|
self.acme = acme.return_value = mock.MagicMock()
|
||||||
self.client = Client(
|
self.client = Client(
|
||||||
@@ -237,7 +238,7 @@ class ClientTestCommon(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class ClientTest(ClientTestCommon):
|
class ClientTest(ClientTestCommon):
|
||||||
"""Tests for certbot.client.Client."""
|
"""Tests for certbot._internal.client.Client."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ClientTest, self).setUp()
|
super(ClientTest, self).setUp()
|
||||||
@@ -272,8 +273,8 @@ class ClientTest(ClientTestCommon):
|
|||||||
self.acme.finalize_order.assert_called_once_with(
|
self.acme.finalize_order.assert_called_once_with(
|
||||||
self.eg_order, mock.ANY)
|
self.eg_order, mock.ANY)
|
||||||
|
|
||||||
@mock.patch("certbot.client.crypto_util")
|
@mock.patch("certbot._internal.client.crypto_util")
|
||||||
@mock.patch("certbot.client.logger")
|
@mock.patch("certbot._internal.client.logger")
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
def test_obtain_certificate_from_csr(self, unused_mock_get_utility,
|
def test_obtain_certificate_from_csr(self, unused_mock_get_utility,
|
||||||
mock_logger, mock_crypto_util):
|
mock_logger, mock_crypto_util):
|
||||||
@@ -308,7 +309,7 @@ class ClientTest(ClientTestCommon):
|
|||||||
test_csr)
|
test_csr)
|
||||||
mock_logger.warning.assert_called_once_with(mock.ANY)
|
mock_logger.warning.assert_called_once_with(mock.ANY)
|
||||||
|
|
||||||
@mock.patch("certbot.client.crypto_util")
|
@mock.patch("certbot._internal.client.crypto_util")
|
||||||
def test_obtain_certificate(self, mock_crypto_util):
|
def test_obtain_certificate(self, mock_crypto_util):
|
||||||
csr = util.CSR(form="pem", file=None, data=CSR_SAN)
|
csr = util.CSR(form="pem", file=None, data=CSR_SAN)
|
||||||
mock_crypto_util.init_save_csr.return_value = csr
|
mock_crypto_util.init_save_csr.return_value = csr
|
||||||
@@ -324,7 +325,7 @@ class ClientTest(ClientTestCommon):
|
|||||||
mock_crypto_util.cert_and_chain_from_fullchain.assert_called_once_with(
|
mock_crypto_util.cert_and_chain_from_fullchain.assert_called_once_with(
|
||||||
self.eg_order.fullchain_pem)
|
self.eg_order.fullchain_pem)
|
||||||
|
|
||||||
@mock.patch("certbot.client.crypto_util")
|
@mock.patch("certbot._internal.client.crypto_util")
|
||||||
@mock.patch("certbot.compat.os.remove")
|
@mock.patch("certbot.compat.os.remove")
|
||||||
def test_obtain_certificate_partial_success(self, mock_remove, mock_crypto_util):
|
def test_obtain_certificate_partial_success(self, mock_remove, mock_crypto_util):
|
||||||
csr = util.CSR(form="pem", file=mock.sentinel.csr_file, data=CSR_SAN)
|
csr = util.CSR(form="pem", file=mock.sentinel.csr_file, data=CSR_SAN)
|
||||||
@@ -342,8 +343,8 @@ class ClientTest(ClientTestCommon):
|
|||||||
self.assertEqual(mock_remove.call_count, 2)
|
self.assertEqual(mock_remove.call_count, 2)
|
||||||
self.assertEqual(mock_crypto_util.cert_and_chain_from_fullchain.call_count, 1)
|
self.assertEqual(mock_crypto_util.cert_and_chain_from_fullchain.call_count, 1)
|
||||||
|
|
||||||
@mock.patch("certbot.client.crypto_util")
|
@mock.patch("certbot._internal.client.crypto_util")
|
||||||
@mock.patch("certbot.client.acme_crypto_util")
|
@mock.patch("certbot._internal.client.acme_crypto_util")
|
||||||
def test_obtain_certificate_dry_run(self, mock_acme_crypto, mock_crypto):
|
def test_obtain_certificate_dry_run(self, mock_acme_crypto, mock_crypto):
|
||||||
csr = util.CSR(form="pem", file=None, data=CSR_SAN)
|
csr = util.CSR(form="pem", file=None, data=CSR_SAN)
|
||||||
mock_acme_crypto.make_csr.return_value = CSR_SAN
|
mock_acme_crypto.make_csr.return_value = CSR_SAN
|
||||||
@@ -361,9 +362,9 @@ class ClientTest(ClientTestCommon):
|
|||||||
mock_crypto.init_save_csr.assert_not_called()
|
mock_crypto.init_save_csr.assert_not_called()
|
||||||
self.assertEqual(mock_crypto.cert_and_chain_from_fullchain.call_count, 1)
|
self.assertEqual(mock_crypto.cert_and_chain_from_fullchain.call_count, 1)
|
||||||
|
|
||||||
@mock.patch("certbot.client.logger")
|
@mock.patch("certbot._internal.client.logger")
|
||||||
@mock.patch("certbot.client.crypto_util")
|
@mock.patch("certbot._internal.client.crypto_util")
|
||||||
@mock.patch("certbot.client.acme_crypto_util")
|
@mock.patch("certbot._internal.client.acme_crypto_util")
|
||||||
def test_obtain_certificate_dry_run_authz_deactivations_failed(self, mock_acme_crypto,
|
def test_obtain_certificate_dry_run_authz_deactivations_failed(self, mock_acme_crypto,
|
||||||
mock_crypto, mock_log):
|
mock_crypto, mock_log):
|
||||||
from acme import messages
|
from acme import messages
|
||||||
@@ -440,8 +441,8 @@ class ClientTest(ClientTestCommon):
|
|||||||
(mock.sentinel.cert, mock.sentinel.chain, key, csr))
|
(mock.sentinel.cert, mock.sentinel.chain, key, csr))
|
||||||
self._check_obtain_certificate(auth_count)
|
self._check_obtain_certificate(auth_count)
|
||||||
|
|
||||||
@mock.patch('certbot.client.Client.obtain_certificate')
|
@mock.patch('certbot._internal.client.Client.obtain_certificate')
|
||||||
@mock.patch('certbot.storage.RenewableCert.new_lineage')
|
@mock.patch('certbot._internal.storage.RenewableCert.new_lineage')
|
||||||
def test_obtain_and_enroll_certificate(self,
|
def test_obtain_and_enroll_certificate(self,
|
||||||
mock_storage, mock_obtain_certificate):
|
mock_storage, mock_obtain_certificate):
|
||||||
domains = ["*.example.com", "example.com"]
|
domains = ["*.example.com", "example.com"]
|
||||||
@@ -563,7 +564,7 @@ class ClientTest(ClientTestCommon):
|
|||||||
|
|
||||||
|
|
||||||
class EnhanceConfigTest(ClientTestCommon):
|
class EnhanceConfigTest(ClientTestCommon):
|
||||||
"""Tests for certbot.client.Client.enhance_config."""
|
"""Tests for certbot._internal.client.Client.enhance_config."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(EnhanceConfigTest, self).setUp()
|
super(EnhanceConfigTest, self).setUp()
|
||||||
@@ -578,20 +579,20 @@ class EnhanceConfigTest(ClientTestCommon):
|
|||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
errors.Error, self.client.enhance_config, [self.domain], None)
|
errors.Error, self.client.enhance_config, [self.domain], None)
|
||||||
|
|
||||||
@mock.patch("certbot.client.enhancements")
|
@mock.patch("certbot._internal.client.enhancements")
|
||||||
def test_unsupported(self, mock_enhancements):
|
def test_unsupported(self, mock_enhancements):
|
||||||
self.client.installer = mock.MagicMock()
|
self.client.installer = mock.MagicMock()
|
||||||
self.client.installer.supported_enhancements.return_value = []
|
self.client.installer.supported_enhancements.return_value = []
|
||||||
|
|
||||||
self.config.redirect = None
|
self.config.redirect = None
|
||||||
self.config.hsts = True
|
self.config.hsts = True
|
||||||
with mock.patch("certbot.client.logger") as mock_logger:
|
with mock.patch("certbot._internal.client.logger") as mock_logger:
|
||||||
self.client.enhance_config([self.domain], None)
|
self.client.enhance_config([self.domain], None)
|
||||||
self.assertEqual(mock_logger.warning.call_count, 1)
|
self.assertEqual(mock_logger.warning.call_count, 1)
|
||||||
self.client.installer.enhance.assert_not_called()
|
self.client.installer.enhance.assert_not_called()
|
||||||
mock_enhancements.ask.assert_not_called()
|
mock_enhancements.ask.assert_not_called()
|
||||||
|
|
||||||
@mock.patch("certbot.client.logger")
|
@mock.patch("certbot._internal.client.logger")
|
||||||
def test_already_exists_header(self, mock_log):
|
def test_already_exists_header(self, mock_log):
|
||||||
self.config.hsts = True
|
self.config.hsts = True
|
||||||
self._test_with_already_existing()
|
self._test_with_already_existing()
|
||||||
@@ -599,7 +600,7 @@ class EnhanceConfigTest(ClientTestCommon):
|
|||||||
self.assertEqual(mock_log.warning.call_args[0][1],
|
self.assertEqual(mock_log.warning.call_args[0][1],
|
||||||
'Strict-Transport-Security')
|
'Strict-Transport-Security')
|
||||||
|
|
||||||
@mock.patch("certbot.client.logger")
|
@mock.patch("certbot._internal.client.logger")
|
||||||
def test_already_exists_redirect(self, mock_log):
|
def test_already_exists_redirect(self, mock_log):
|
||||||
self.config.redirect = True
|
self.config.redirect = True
|
||||||
self._test_with_already_existing()
|
self._test_with_already_existing()
|
||||||
@@ -607,14 +608,14 @@ class EnhanceConfigTest(ClientTestCommon):
|
|||||||
self.assertEqual(mock_log.warning.call_args[0][1],
|
self.assertEqual(mock_log.warning.call_args[0][1],
|
||||||
'redirect')
|
'redirect')
|
||||||
|
|
||||||
@mock.patch("certbot.client.logger")
|
@mock.patch("certbot._internal.client.logger")
|
||||||
def test_config_set_no_warning_redirect(self, mock_log):
|
def test_config_set_no_warning_redirect(self, mock_log):
|
||||||
self.config.redirect = False
|
self.config.redirect = False
|
||||||
self._test_with_already_existing()
|
self._test_with_already_existing()
|
||||||
self.assertFalse(mock_log.warning.called)
|
self.assertFalse(mock_log.warning.called)
|
||||||
|
|
||||||
@mock.patch("certbot.client.enhancements.ask")
|
@mock.patch("certbot._internal.client.enhancements.ask")
|
||||||
@mock.patch("certbot.client.logger")
|
@mock.patch("certbot._internal.client.logger")
|
||||||
def test_warn_redirect(self, mock_log, mock_ask):
|
def test_warn_redirect(self, mock_log, mock_ask):
|
||||||
self.config.redirect = None
|
self.config.redirect = None
|
||||||
mock_ask.return_value = False
|
mock_ask.return_value = False
|
||||||
@@ -671,7 +672,7 @@ class EnhanceConfigTest(ClientTestCommon):
|
|||||||
self.client.installer = installer
|
self.client.installer = installer
|
||||||
self._test_error_with_rollback()
|
self._test_error_with_rollback()
|
||||||
|
|
||||||
@mock.patch("certbot.client.enhancements.ask")
|
@mock.patch("certbot._internal.client.enhancements.ask")
|
||||||
def test_ask(self, mock_ask):
|
def test_ask(self, mock_ask):
|
||||||
self.config.redirect = None
|
self.config.redirect = None
|
||||||
mock_ask.return_value = True
|
mock_ask.return_value = True
|
||||||
@@ -706,15 +707,15 @@ class EnhanceConfigTest(ClientTestCommon):
|
|||||||
|
|
||||||
|
|
||||||
class RollbackTest(unittest.TestCase):
|
class RollbackTest(unittest.TestCase):
|
||||||
"""Tests for certbot.client.rollback."""
|
"""Tests for certbot._internal.client.rollback."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.m_install = mock.MagicMock()
|
self.m_install = mock.MagicMock()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _call(cls, checkpoints, side_effect):
|
def _call(cls, checkpoints, side_effect):
|
||||||
from certbot.client import rollback
|
from certbot._internal.client import rollback
|
||||||
with mock.patch("certbot.client.plugin_selection.pick_installer") as mpi:
|
with mock.patch("certbot._internal.client.plugin_selection.pick_installer") as mpi:
|
||||||
mpi.side_effect = side_effect
|
mpi.side_effect = side_effect
|
||||||
rollback(None, checkpoints, {}, mock.MagicMock())
|
rollback(None, checkpoints, {}, mock.MagicMock())
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ except ImportError:
|
|||||||
POSIX_MODE = True
|
POSIX_MODE = True
|
||||||
|
|
||||||
import certbot.tests.util as test_util
|
import certbot.tests.util as test_util
|
||||||
from certbot import lock
|
from certbot._internal import lock
|
||||||
from certbot import util
|
from certbot import util
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.compat import filesystem
|
from certbot.compat import filesystem
|
||||||
|
@@ -10,7 +10,7 @@ import zope.component
|
|||||||
from acme import messages
|
from acme import messages
|
||||||
|
|
||||||
import certbot.tests.util as test_util
|
import certbot.tests.util as test_util
|
||||||
from certbot import account
|
from certbot._internal import account
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.compat import filesystem
|
from certbot.compat import filesystem
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
"""Tests for certbot.error_handler."""
|
"""Tests for certbot._internal.error_handler."""
|
||||||
import contextlib
|
import contextlib
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
@@ -40,10 +40,10 @@ def send_signal(signum):
|
|||||||
|
|
||||||
|
|
||||||
class ErrorHandlerTest(unittest.TestCase):
|
class ErrorHandlerTest(unittest.TestCase):
|
||||||
"""Tests for certbot.error_handler.ErrorHandler."""
|
"""Tests for certbot._internal.error_handler.ErrorHandler."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot import error_handler
|
from certbot._internal import error_handler
|
||||||
|
|
||||||
self.init_func = mock.MagicMock()
|
self.init_func = mock.MagicMock()
|
||||||
self.init_args = set((42,))
|
self.init_args = set((42,))
|
||||||
@@ -132,10 +132,10 @@ class ErrorHandlerTest(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class ExitHandlerTest(ErrorHandlerTest):
|
class ExitHandlerTest(ErrorHandlerTest):
|
||||||
"""Tests for certbot.error_handler.ExitHandler."""
|
"""Tests for certbot._internal.error_handler.ExitHandler."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot import error_handler
|
from certbot._internal import error_handler
|
||||||
super(ExitHandlerTest, self).setUp()
|
super(ExitHandlerTest, self).setUp()
|
||||||
self.handler = error_handler.ExitHandler(self.init_func,
|
self.handler = error_handler.ExitHandler(self.init_func,
|
||||||
*self.init_args,
|
*self.init_args,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
"""Tests for certbot.lock."""
|
"""Tests for certbot._internal.lock."""
|
||||||
import functools
|
import functools
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import unittest
|
import unittest
|
||||||
@@ -17,10 +17,10 @@ from certbot.tests import util as test_util
|
|||||||
|
|
||||||
|
|
||||||
class LockDirTest(test_util.TempDirTestCase):
|
class LockDirTest(test_util.TempDirTestCase):
|
||||||
"""Tests for certbot.lock.lock_dir."""
|
"""Tests for certbot._internal.lock.lock_dir."""
|
||||||
@classmethod
|
@classmethod
|
||||||
def _call(cls, *args, **kwargs):
|
def _call(cls, *args, **kwargs):
|
||||||
from certbot.lock import lock_dir
|
from certbot._internal.lock import lock_dir
|
||||||
return lock_dir(*args, **kwargs)
|
return lock_dir(*args, **kwargs)
|
||||||
|
|
||||||
def test_it(self):
|
def test_it(self):
|
||||||
@@ -31,10 +31,10 @@ class LockDirTest(test_util.TempDirTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class LockFileTest(test_util.TempDirTestCase):
|
class LockFileTest(test_util.TempDirTestCase):
|
||||||
"""Tests for certbot.lock.LockFile."""
|
"""Tests for certbot._internal.lock.LockFile."""
|
||||||
@classmethod
|
@classmethod
|
||||||
def _call(cls, *args, **kwargs):
|
def _call(cls, *args, **kwargs):
|
||||||
from certbot.lock import LockFile
|
from certbot._internal.lock import LockFile
|
||||||
return LockFile(*args, **kwargs)
|
return LockFile(*args, **kwargs)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -93,7 +93,7 @@ class LockFileTest(test_util.TempDirTestCase):
|
|||||||
os.remove(path)
|
os.remove(path)
|
||||||
return stat(path)
|
return stat(path)
|
||||||
|
|
||||||
with mock.patch('certbot.lock.filesystem.os.stat') as mock_stat:
|
with mock.patch('certbot._internal.lock.filesystem.os.stat') as mock_stat:
|
||||||
mock_stat.side_effect = delete_and_stat
|
mock_stat.side_effect = delete_and_stat
|
||||||
self._call(self.lock_path)
|
self._call(self.lock_path)
|
||||||
self.assertFalse(should_delete)
|
self.assertFalse(should_delete)
|
||||||
@@ -105,9 +105,9 @@ class LockFileTest(test_util.TempDirTestCase):
|
|||||||
|
|
||||||
def test_unexpected_lockf_or_locking_err(self):
|
def test_unexpected_lockf_or_locking_err(self):
|
||||||
if POSIX_MODE:
|
if POSIX_MODE:
|
||||||
mocked_function = 'certbot.lock.fcntl.lockf'
|
mocked_function = 'certbot._internal.lock.fcntl.lockf'
|
||||||
else:
|
else:
|
||||||
mocked_function = 'certbot.lock.msvcrt.locking'
|
mocked_function = 'certbot._internal.lock.msvcrt.locking'
|
||||||
msg = 'hi there'
|
msg = 'hi there'
|
||||||
with mock.patch(mocked_function) as mock_lock:
|
with mock.patch(mocked_function) as mock_lock:
|
||||||
mock_lock.side_effect = IOError(msg)
|
mock_lock.side_effect = IOError(msg)
|
||||||
@@ -120,9 +120,9 @@ class LockFileTest(test_util.TempDirTestCase):
|
|||||||
|
|
||||||
def test_unexpected_os_err(self):
|
def test_unexpected_os_err(self):
|
||||||
if POSIX_MODE:
|
if POSIX_MODE:
|
||||||
mock_function = 'certbot.lock.filesystem.os.stat'
|
mock_function = 'certbot._internal.lock.filesystem.os.stat'
|
||||||
else:
|
else:
|
||||||
mock_function = 'certbot.lock.msvcrt.locking'
|
mock_function = 'certbot._internal.lock.msvcrt.locking'
|
||||||
# The only expected errno are ENOENT and EACCES in lock module.
|
# The only expected errno are ENOENT and EACCES in lock module.
|
||||||
msg = 'hi there'
|
msg = 'hi there'
|
||||||
with mock.patch(mock_function) as mock_os:
|
with mock.patch(mock_function) as mock_os:
|
||||||
|
@@ -135,7 +135,7 @@ class SetupLogFileHandlerTest(test_util.ConfigTestCase):
|
|||||||
super(SetupLogFileHandlerTest, self).setUp()
|
super(SetupLogFileHandlerTest, self).setUp()
|
||||||
self.config.max_log_backups = 42
|
self.config.max_log_backups = 42
|
||||||
|
|
||||||
@mock.patch('certbot.main.logging.handlers.RotatingFileHandler')
|
@mock.patch('certbot._internal.main.logging.handlers.RotatingFileHandler')
|
||||||
def test_failure(self, mock_handler):
|
def test_failure(self, mock_handler):
|
||||||
mock_handler.side_effect = IOError
|
mock_handler.side_effect = IOError
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
"""Tests for certbot.notify."""
|
"""Tests for certbot._internal.notify."""
|
||||||
import socket
|
import socket
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@@ -8,9 +8,9 @@ import mock
|
|||||||
class NotifyTests(unittest.TestCase):
|
class NotifyTests(unittest.TestCase):
|
||||||
"""Tests for the notifier."""
|
"""Tests for the notifier."""
|
||||||
|
|
||||||
@mock.patch("certbot.notify.smtplib.LMTP")
|
@mock.patch("certbot._internal.notify.smtplib.LMTP")
|
||||||
def test_smtp_success(self, mock_lmtp):
|
def test_smtp_success(self, mock_lmtp):
|
||||||
from certbot.notify import notify
|
from certbot._internal.notify import notify
|
||||||
lmtp_obj = mock.MagicMock()
|
lmtp_obj = mock.MagicMock()
|
||||||
mock_lmtp.return_value = lmtp_obj
|
mock_lmtp.return_value = lmtp_obj
|
||||||
self.assertTrue(notify("Goose", "auntrhody@example.com",
|
self.assertTrue(notify("Goose", "auntrhody@example.com",
|
||||||
@@ -18,10 +18,10 @@ class NotifyTests(unittest.TestCase):
|
|||||||
self.assertEqual(lmtp_obj.connect.call_count, 1)
|
self.assertEqual(lmtp_obj.connect.call_count, 1)
|
||||||
self.assertEqual(lmtp_obj.sendmail.call_count, 1)
|
self.assertEqual(lmtp_obj.sendmail.call_count, 1)
|
||||||
|
|
||||||
@mock.patch("certbot.notify.smtplib.LMTP")
|
@mock.patch("certbot._internal.notify.smtplib.LMTP")
|
||||||
@mock.patch("certbot.notify.subprocess.Popen")
|
@mock.patch("certbot._internal.notify.subprocess.Popen")
|
||||||
def test_smtp_failure(self, mock_popen, mock_lmtp):
|
def test_smtp_failure(self, mock_popen, mock_lmtp):
|
||||||
from certbot.notify import notify
|
from certbot._internal.notify import notify
|
||||||
lmtp_obj = mock.MagicMock()
|
lmtp_obj = mock.MagicMock()
|
||||||
mock_lmtp.return_value = lmtp_obj
|
mock_lmtp.return_value = lmtp_obj
|
||||||
lmtp_obj.sendmail.side_effect = socket.error(17)
|
lmtp_obj.sendmail.side_effect = socket.error(17)
|
||||||
@@ -32,10 +32,10 @@ class NotifyTests(unittest.TestCase):
|
|||||||
self.assertEqual(lmtp_obj.sendmail.call_count, 1)
|
self.assertEqual(lmtp_obj.sendmail.call_count, 1)
|
||||||
self.assertEqual(proc.communicate.call_count, 1)
|
self.assertEqual(proc.communicate.call_count, 1)
|
||||||
|
|
||||||
@mock.patch("certbot.notify.smtplib.LMTP")
|
@mock.patch("certbot._internal.notify.smtplib.LMTP")
|
||||||
@mock.patch("certbot.notify.subprocess.Popen")
|
@mock.patch("certbot._internal.notify.subprocess.Popen")
|
||||||
def test_everything_fails(self, mock_popen, mock_lmtp):
|
def test_everything_fails(self, mock_popen, mock_lmtp):
|
||||||
from certbot.notify import notify
|
from certbot._internal.notify import notify
|
||||||
lmtp_obj = mock.MagicMock()
|
lmtp_obj = mock.MagicMock()
|
||||||
mock_lmtp.return_value = lmtp_obj
|
mock_lmtp.return_value = lmtp_obj
|
||||||
lmtp_obj.sendmail.side_effect = socket.error(17)
|
lmtp_obj.sendmail.side_effect = socket.error(17)
|
||||||
|
@@ -32,8 +32,8 @@ class OCSPTestOpenSSL(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot import ocsp
|
from certbot._internal import ocsp
|
||||||
with mock.patch('certbot.ocsp.Popen') as mock_popen:
|
with mock.patch('certbot._internal.ocsp.Popen') as mock_popen:
|
||||||
with mock.patch('certbot.util.exe_exists') as mock_exists:
|
with mock.patch('certbot.util.exe_exists') as mock_exists:
|
||||||
mock_communicate = mock.MagicMock()
|
mock_communicate = mock.MagicMock()
|
||||||
mock_communicate.communicate.return_value = (None, out)
|
mock_communicate.communicate.return_value = (None, out)
|
||||||
@@ -44,8 +44,8 @@ class OCSPTestOpenSSL(unittest.TestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@mock.patch('certbot.ocsp.logger.info')
|
@mock.patch('certbot._internal.ocsp.logger.info')
|
||||||
@mock.patch('certbot.ocsp.Popen')
|
@mock.patch('certbot._internal.ocsp.Popen')
|
||||||
@mock.patch('certbot.util.exe_exists')
|
@mock.patch('certbot.util.exe_exists')
|
||||||
def test_init(self, mock_exists, mock_popen, mock_log):
|
def test_init(self, mock_exists, mock_popen, mock_log):
|
||||||
mock_communicate = mock.MagicMock()
|
mock_communicate = mock.MagicMock()
|
||||||
@@ -53,7 +53,7 @@ class OCSPTestOpenSSL(unittest.TestCase):
|
|||||||
mock_popen.return_value = mock_communicate
|
mock_popen.return_value = mock_communicate
|
||||||
mock_exists.return_value = True
|
mock_exists.return_value = True
|
||||||
|
|
||||||
from certbot import ocsp
|
from certbot._internal import ocsp
|
||||||
checker = ocsp.RevocationChecker(enforce_openssl_binary_usage=True)
|
checker = ocsp.RevocationChecker(enforce_openssl_binary_usage=True)
|
||||||
self.assertEqual(mock_popen.call_count, 1)
|
self.assertEqual(mock_popen.call_count, 1)
|
||||||
self.assertEqual(checker.host_args("x"), ["Host=x"])
|
self.assertEqual(checker.host_args("x"), ["Host=x"])
|
||||||
@@ -70,7 +70,7 @@ class OCSPTestOpenSSL(unittest.TestCase):
|
|||||||
self.assertEqual(mock_log.call_count, 1)
|
self.assertEqual(mock_log.call_count, 1)
|
||||||
self.assertEqual(checker.broken, True)
|
self.assertEqual(checker.broken, True)
|
||||||
|
|
||||||
@mock.patch('certbot.ocsp._determine_ocsp_server')
|
@mock.patch('certbot._internal.ocsp._determine_ocsp_server')
|
||||||
@mock.patch('certbot.util.run_script')
|
@mock.patch('certbot.util.run_script')
|
||||||
def test_ocsp_revoked(self, mock_run, mock_determine):
|
def test_ocsp_revoked(self, mock_run, mock_determine):
|
||||||
now = pytz.UTC.fromutc(datetime.utcnow())
|
now = pytz.UTC.fromutc(datetime.utcnow())
|
||||||
@@ -104,16 +104,16 @@ class OCSPTestOpenSSL(unittest.TestCase):
|
|||||||
def test_determine_ocsp_server(self):
|
def test_determine_ocsp_server(self):
|
||||||
cert_path = test_util.vector_path('ocsp_certificate.pem')
|
cert_path = test_util.vector_path('ocsp_certificate.pem')
|
||||||
|
|
||||||
from certbot import ocsp
|
from certbot._internal import ocsp
|
||||||
result = ocsp._determine_ocsp_server(cert_path)
|
result = ocsp._determine_ocsp_server(cert_path)
|
||||||
self.assertEqual(('http://ocsp.test4.buypass.com', 'ocsp.test4.buypass.com'), result)
|
self.assertEqual(('http://ocsp.test4.buypass.com', 'ocsp.test4.buypass.com'), result)
|
||||||
|
|
||||||
@mock.patch('certbot.ocsp.logger')
|
@mock.patch('certbot._internal.ocsp.logger')
|
||||||
@mock.patch('certbot.util.run_script')
|
@mock.patch('certbot.util.run_script')
|
||||||
def test_translate_ocsp(self, mock_run, mock_log):
|
def test_translate_ocsp(self, mock_run, mock_log):
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
mock_run.return_value = openssl_confused
|
mock_run.return_value = openssl_confused
|
||||||
from certbot import ocsp
|
from certbot._internal import ocsp
|
||||||
self.assertEqual(ocsp._translate_ocsp_query(*openssl_happy), False)
|
self.assertEqual(ocsp._translate_ocsp_query(*openssl_happy), False)
|
||||||
self.assertEqual(ocsp._translate_ocsp_query(*openssl_confused), False)
|
self.assertEqual(ocsp._translate_ocsp_query(*openssl_confused), False)
|
||||||
self.assertEqual(mock_log.debug.call_count, 1)
|
self.assertEqual(mock_log.debug.call_count, 1)
|
||||||
@@ -141,7 +141,7 @@ class OSCPTestCryptography(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot import ocsp
|
from certbot._internal import ocsp
|
||||||
self.checker = ocsp.RevocationChecker()
|
self.checker = ocsp.RevocationChecker()
|
||||||
self.cert_path = test_util.vector_path('ocsp_certificate.pem')
|
self.cert_path = test_util.vector_path('ocsp_certificate.pem')
|
||||||
self.chain_path = test_util.vector_path('ocsp_issuer_certificate.pem')
|
self.chain_path = test_util.vector_path('ocsp_issuer_certificate.pem')
|
||||||
@@ -151,8 +151,8 @@ class OSCPTestCryptography(unittest.TestCase):
|
|||||||
now = pytz.UTC.fromutc(datetime.utcnow())
|
now = pytz.UTC.fromutc(datetime.utcnow())
|
||||||
self.cert_obj.target_expiry = now + timedelta(hours=2)
|
self.cert_obj.target_expiry = now + timedelta(hours=2)
|
||||||
|
|
||||||
@mock.patch('certbot.ocsp._determine_ocsp_server')
|
@mock.patch('certbot._internal.ocsp._determine_ocsp_server')
|
||||||
@mock.patch('certbot.ocsp._check_ocsp_cryptography')
|
@mock.patch('certbot._internal.ocsp._check_ocsp_cryptography')
|
||||||
def test_ensure_cryptography_toggled(self, mock_revoke, mock_determine):
|
def test_ensure_cryptography_toggled(self, mock_revoke, mock_determine):
|
||||||
mock_determine.return_value = ('http://example.com', 'example.com')
|
mock_determine.return_value = ('http://example.com', 'example.com')
|
||||||
self.checker.ocsp_revoked(self.cert_obj)
|
self.checker.ocsp_revoked(self.cert_obj)
|
||||||
@@ -259,7 +259,7 @@ class OSCPTestCryptography(unittest.TestCase):
|
|||||||
with _ocsp_mock(ocsp_lib.OCSPCertStatus.REVOKED, ocsp_lib.OCSPResponseStatus.SUCCESSFUL):
|
with _ocsp_mock(ocsp_lib.OCSPCertStatus.REVOKED, ocsp_lib.OCSPResponseStatus.SUCCESSFUL):
|
||||||
# This mock is necessary to avoid the first call contained in _determine_ocsp_server
|
# This mock is necessary to avoid the first call contained in _determine_ocsp_server
|
||||||
# of the method cryptography.x509.Extensions.get_extension_for_class.
|
# of the method cryptography.x509.Extensions.get_extension_for_class.
|
||||||
with mock.patch('certbot.ocsp._determine_ocsp_server') as mock_server:
|
with mock.patch('certbot._internal.ocsp._determine_ocsp_server') as mock_server:
|
||||||
mock_server.return_value = ('https://example.com', 'example.com')
|
mock_server.return_value = ('https://example.com', 'example.com')
|
||||||
with mock.patch('cryptography.x509.Extensions.get_extension_for_class',
|
with mock.patch('cryptography.x509.Extensions.get_extension_for_class',
|
||||||
side_effect=x509.ExtensionNotFound(
|
side_effect=x509.ExtensionNotFound(
|
||||||
@@ -271,12 +271,13 @@ class OSCPTestCryptography(unittest.TestCase):
|
|||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _ocsp_mock(certificate_status, response_status,
|
def _ocsp_mock(certificate_status, response_status,
|
||||||
http_status_code=200, check_signature_side_effect=None):
|
http_status_code=200, check_signature_side_effect=None):
|
||||||
with mock.patch('certbot.ocsp.ocsp.load_der_ocsp_response') as mock_response:
|
with mock.patch('certbot._internal.ocsp.ocsp.load_der_ocsp_response') as mock_response:
|
||||||
mock_response.return_value = _construct_mock_ocsp_response(
|
mock_response.return_value = _construct_mock_ocsp_response(
|
||||||
certificate_status, response_status)
|
certificate_status, response_status)
|
||||||
with mock.patch('certbot.ocsp.requests.post') as mock_post:
|
with mock.patch('certbot._internal.ocsp.requests.post') as mock_post:
|
||||||
mock_post.return_value = mock.Mock(status_code=http_status_code)
|
mock_post.return_value = mock.Mock(status_code=http_status_code)
|
||||||
with mock.patch('certbot.ocsp.crypto_util.verify_signed_payload') as mock_check:
|
with mock.patch('certbot._internal.ocsp.crypto_util.verify_signed_payload') \
|
||||||
|
as mock_check:
|
||||||
if check_signature_side_effect:
|
if check_signature_side_effect:
|
||||||
mock_check.side_effect = check_signature_side_effect
|
mock_check.side_effect = check_signature_side_effect
|
||||||
yield {
|
yield {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
"""Tests for certbot.renewal"""
|
"""Tests for certbot._internal.renewal"""
|
||||||
import unittest
|
import unittest
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ from acme import challenges
|
|||||||
|
|
||||||
from certbot import configuration
|
from certbot import configuration
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
|
|
||||||
import certbot.tests.util as test_util
|
import certbot.tests.util as test_util
|
||||||
|
|
||||||
@@ -24,15 +24,15 @@ class RenewalTest(test_util.ConfigTestCase):
|
|||||||
lineage = storage.RenewableCert(rc_path, config)
|
lineage = storage.RenewableCert(rc_path, config)
|
||||||
renewalparams = lineage.configuration['renewalparams']
|
renewalparams = lineage.configuration['renewalparams']
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
from certbot import renewal
|
from certbot._internal import renewal
|
||||||
renewal._restore_webroot_config(config, renewalparams)
|
renewal._restore_webroot_config(config, renewalparams)
|
||||||
self.assertEqual(config.webroot_path, ['/var/www/'])
|
self.assertEqual(config.webroot_path, ['/var/www/'])
|
||||||
|
|
||||||
@mock.patch('certbot.renewal.cli.set_by_cli')
|
@mock.patch('certbot._internal.renewal.cli.set_by_cli')
|
||||||
def test_webroot_params_conservation(self, mock_set_by_cli):
|
def test_webroot_params_conservation(self, mock_set_by_cli):
|
||||||
# For more details about why this test is important, see:
|
# For more details about why this test is important, see:
|
||||||
# certbot.plugins.webroot_test::WebrootActionTest::test_webroot_map_partial_without_perform
|
# certbot.plugins.webroot_test::WebrootActionTest::test_webroot_map_partial_without_perform
|
||||||
from certbot import renewal
|
from certbot._internal import renewal
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
|
|
||||||
renewalparams = {
|
renewalparams = {
|
||||||
@@ -53,26 +53,26 @@ class RenewalTest(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class RestoreRequiredConfigElementsTest(test_util.ConfigTestCase):
|
class RestoreRequiredConfigElementsTest(test_util.ConfigTestCase):
|
||||||
"""Tests for certbot.renewal.restore_required_config_elements."""
|
"""Tests for certbot._internal.renewal.restore_required_config_elements."""
|
||||||
@classmethod
|
@classmethod
|
||||||
def _call(cls, *args, **kwargs):
|
def _call(cls, *args, **kwargs):
|
||||||
from certbot.renewal import restore_required_config_elements
|
from certbot._internal.renewal import restore_required_config_elements
|
||||||
return restore_required_config_elements(*args, **kwargs)
|
return restore_required_config_elements(*args, **kwargs)
|
||||||
|
|
||||||
@mock.patch('certbot.renewal.cli.set_by_cli')
|
@mock.patch('certbot._internal.renewal.cli.set_by_cli')
|
||||||
def test_allow_subset_of_names_success(self, mock_set_by_cli):
|
def test_allow_subset_of_names_success(self, mock_set_by_cli):
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
self._call(self.config, {'allow_subset_of_names': 'True'})
|
self._call(self.config, {'allow_subset_of_names': 'True'})
|
||||||
self.assertTrue(self.config.allow_subset_of_names is True)
|
self.assertTrue(self.config.allow_subset_of_names is True)
|
||||||
|
|
||||||
@mock.patch('certbot.renewal.cli.set_by_cli')
|
@mock.patch('certbot._internal.renewal.cli.set_by_cli')
|
||||||
def test_allow_subset_of_names_failure(self, mock_set_by_cli):
|
def test_allow_subset_of_names_failure(self, mock_set_by_cli):
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
renewalparams = {'allow_subset_of_names': 'maybe'}
|
renewalparams = {'allow_subset_of_names': 'maybe'}
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
errors.Error, self._call, self.config, renewalparams)
|
errors.Error, self._call, self.config, renewalparams)
|
||||||
|
|
||||||
@mock.patch('certbot.renewal.cli.set_by_cli')
|
@mock.patch('certbot._internal.renewal.cli.set_by_cli')
|
||||||
def test_pref_challs_list(self, mock_set_by_cli):
|
def test_pref_challs_list(self, mock_set_by_cli):
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
renewalparams = {'pref_challs': 'http-01, dns'.split(',')}
|
renewalparams = {'pref_challs': 'http-01, dns'.split(',')}
|
||||||
@@ -80,7 +80,7 @@ class RestoreRequiredConfigElementsTest(test_util.ConfigTestCase):
|
|||||||
expected = [challenges.HTTP01.typ, challenges.DNS01.typ]
|
expected = [challenges.HTTP01.typ, challenges.DNS01.typ]
|
||||||
self.assertEqual(self.config.pref_challs, expected)
|
self.assertEqual(self.config.pref_challs, expected)
|
||||||
|
|
||||||
@mock.patch('certbot.renewal.cli.set_by_cli')
|
@mock.patch('certbot._internal.renewal.cli.set_by_cli')
|
||||||
def test_pref_challs_str(self, mock_set_by_cli):
|
def test_pref_challs_str(self, mock_set_by_cli):
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
renewalparams = {'pref_challs': 'dns'}
|
renewalparams = {'pref_challs': 'dns'}
|
||||||
@@ -88,19 +88,19 @@ class RestoreRequiredConfigElementsTest(test_util.ConfigTestCase):
|
|||||||
expected = [challenges.DNS01.typ]
|
expected = [challenges.DNS01.typ]
|
||||||
self.assertEqual(self.config.pref_challs, expected)
|
self.assertEqual(self.config.pref_challs, expected)
|
||||||
|
|
||||||
@mock.patch('certbot.renewal.cli.set_by_cli')
|
@mock.patch('certbot._internal.renewal.cli.set_by_cli')
|
||||||
def test_pref_challs_failure(self, mock_set_by_cli):
|
def test_pref_challs_failure(self, mock_set_by_cli):
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
renewalparams = {'pref_challs': 'finding-a-shrubbery'}
|
renewalparams = {'pref_challs': 'finding-a-shrubbery'}
|
||||||
self.assertRaises(errors.Error, self._call, self.config, renewalparams)
|
self.assertRaises(errors.Error, self._call, self.config, renewalparams)
|
||||||
|
|
||||||
@mock.patch('certbot.renewal.cli.set_by_cli')
|
@mock.patch('certbot._internal.renewal.cli.set_by_cli')
|
||||||
def test_must_staple_success(self, mock_set_by_cli):
|
def test_must_staple_success(self, mock_set_by_cli):
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
self._call(self.config, {'must_staple': 'True'})
|
self._call(self.config, {'must_staple': 'True'})
|
||||||
self.assertTrue(self.config.must_staple is True)
|
self.assertTrue(self.config.must_staple is True)
|
||||||
|
|
||||||
@mock.patch('certbot.renewal.cli.set_by_cli')
|
@mock.patch('certbot._internal.renewal.cli.set_by_cli')
|
||||||
def test_must_staple_failure(self, mock_set_by_cli):
|
def test_must_staple_failure(self, mock_set_by_cli):
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
renewalparams = {'must_staple': 'maybe'}
|
renewalparams = {'must_staple': 'maybe'}
|
||||||
|
@@ -3,8 +3,8 @@ import unittest
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from certbot import interfaces
|
from certbot import interfaces
|
||||||
from certbot import main
|
from certbot._internal import main
|
||||||
from certbot import updater
|
from certbot._internal import updater
|
||||||
|
|
||||||
from certbot.plugins import enhancements
|
from certbot.plugins import enhancements
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ class RenewUpdaterTest(test_util.ConfigTestCase):
|
|||||||
self.renew_deployer = mock.MagicMock(spec=interfaces.RenewDeployer)
|
self.renew_deployer = mock.MagicMock(spec=interfaces.RenewDeployer)
|
||||||
self.mockinstaller = mock.MagicMock(spec=enhancements.AutoHSTSEnhancement)
|
self.mockinstaller = mock.MagicMock(spec=enhancements.AutoHSTSEnhancement)
|
||||||
|
|
||||||
@mock.patch('certbot.main._get_and_save_cert')
|
@mock.patch('certbot._internal.main._get_and_save_cert')
|
||||||
@mock.patch('certbot.plugins.selection.choose_configurator_plugins')
|
@mock.patch('certbot.plugins.selection.choose_configurator_plugins')
|
||||||
@mock.patch('certbot.plugins.selection.get_unprepared_installer')
|
@mock.patch('certbot.plugins.selection.get_unprepared_installer')
|
||||||
@test_util.patch_get_utility()
|
@test_util.patch_get_utility()
|
||||||
@@ -32,7 +32,7 @@ class RenewUpdaterTest(test_util.ConfigTestCase):
|
|||||||
# Generic Updater
|
# Generic Updater
|
||||||
mock_select.return_value = (mock_generic_updater, None)
|
mock_select.return_value = (mock_generic_updater, None)
|
||||||
mock_geti.return_value = mock_generic_updater
|
mock_geti.return_value = mock_generic_updater
|
||||||
with mock.patch('certbot.main._init_le_client'):
|
with mock.patch('certbot._internal.main._init_le_client'):
|
||||||
main.renew_cert(self.config, None, mock.MagicMock())
|
main.renew_cert(self.config, None, mock.MagicMock())
|
||||||
self.assertTrue(mock_generic_updater.restart.called)
|
self.assertTrue(mock_generic_updater.restart.called)
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ class RenewUpdaterTest(test_util.ConfigTestCase):
|
|||||||
updater.run_renewal_deployer(self.config, lineage, mock_deployer)
|
updater.run_renewal_deployer(self.config, lineage, mock_deployer)
|
||||||
self.assertTrue(mock_deployer.renew_deploy.called_with(lineage))
|
self.assertTrue(mock_deployer.renew_deploy.called_with(lineage))
|
||||||
|
|
||||||
@mock.patch("certbot.updater.logger.debug")
|
@mock.patch("certbot._internal.updater.logger.debug")
|
||||||
def test_updater_skip_dry_run(self, mock_log):
|
def test_updater_skip_dry_run(self, mock_log):
|
||||||
self.config.dry_run = True
|
self.config.dry_run = True
|
||||||
updater.run_generic_updaters(self.config, None, None)
|
updater.run_generic_updaters(self.config, None, None)
|
||||||
@@ -56,7 +56,7 @@ class RenewUpdaterTest(test_util.ConfigTestCase):
|
|||||||
self.assertEqual(mock_log.call_args[0][0],
|
self.assertEqual(mock_log.call_args[0][0],
|
||||||
"Skipping updaters in dry-run mode.")
|
"Skipping updaters in dry-run mode.")
|
||||||
|
|
||||||
@mock.patch("certbot.updater.logger.debug")
|
@mock.patch("certbot._internal.updater.logger.debug")
|
||||||
def test_deployer_skip_dry_run(self, mock_log):
|
def test_deployer_skip_dry_run(self, mock_log):
|
||||||
self.config.dry_run = True
|
self.config.dry_run = True
|
||||||
updater.run_renewal_deployer(self.config, None, None)
|
updater.run_renewal_deployer(self.config, None, None)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
"""Tests for certbot.reporter."""
|
"""Tests for certbot._internal.reporter."""
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
import mock
|
import mock
|
||||||
@@ -7,9 +7,9 @@ import six
|
|||||||
|
|
||||||
|
|
||||||
class ReporterTest(unittest.TestCase):
|
class ReporterTest(unittest.TestCase):
|
||||||
"""Tests for certbot.reporter.Reporter."""
|
"""Tests for certbot._internal.reporter.Reporter."""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot import reporter
|
from certbot._internal import reporter
|
||||||
self.reporter = reporter.Reporter(mock.MagicMock(quiet=False))
|
self.reporter = reporter.Reporter(mock.MagicMock(quiet=False))
|
||||||
|
|
||||||
self.old_stdout = sys.stdout # type: ignore
|
self.old_stdout = sys.stdout # type: ignore
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
"""Tests for certbot.storage."""
|
"""Tests for certbot._internal.storage."""
|
||||||
# pylint disable=protected-access
|
# pylint disable=protected-access
|
||||||
import datetime
|
import datetime
|
||||||
import shutil
|
import shutil
|
||||||
@@ -15,7 +15,7 @@ import certbot.tests.util as test_util
|
|||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.compat import filesystem
|
from certbot.compat import filesystem
|
||||||
from certbot.storage import ALL_FOUR
|
from certbot._internal.storage import ALL_FOUR
|
||||||
|
|
||||||
CERT = test_util.load_cert('cert_512.pem')
|
CERT = test_util.load_cert('cert_512.pem')
|
||||||
|
|
||||||
@@ -34,13 +34,13 @@ def fill_with_sample_data(rc_object):
|
|||||||
|
|
||||||
|
|
||||||
class RelevantValuesTest(unittest.TestCase):
|
class RelevantValuesTest(unittest.TestCase):
|
||||||
"""Tests for certbot.storage.relevant_values."""
|
"""Tests for certbot._internal.storage.relevant_values."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.values = {"server": "example.org"}
|
self.values = {"server": "example.org"}
|
||||||
|
|
||||||
def _call(self, *args, **kwargs):
|
def _call(self, *args, **kwargs):
|
||||||
from certbot.storage import relevant_values
|
from certbot._internal.storage import relevant_values
|
||||||
return relevant_values(*args, **kwargs)
|
return relevant_values(*args, **kwargs)
|
||||||
|
|
||||||
@mock.patch("certbot.cli.option_was_set")
|
@mock.patch("certbot.cli.option_was_set")
|
||||||
@@ -84,7 +84,7 @@ class BaseRenewableCertTest(test_util.ConfigTestCase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
|
|
||||||
super(BaseRenewableCertTest, self).setUp()
|
super(BaseRenewableCertTest, self).setUp()
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ class BaseRenewableCertTest(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
self.defaults = configobj.ConfigObj()
|
self.defaults = configobj.ConfigObj()
|
||||||
|
|
||||||
with mock.patch("certbot.storage.RenewableCert._check_symlinks") as check:
|
with mock.patch("certbot._internal.storage.RenewableCert._check_symlinks") as check:
|
||||||
check.return_value = True
|
check.return_value = True
|
||||||
self.test_rc = storage.RenewableCert(config_file.filename, self.config)
|
self.test_rc = storage.RenewableCert(config_file.filename, self.config)
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ class BaseRenewableCertTest(test_util.ConfigTestCase):
|
|||||||
|
|
||||||
class RenewableCertTests(BaseRenewableCertTest):
|
class RenewableCertTests(BaseRenewableCertTest):
|
||||||
# pylint: disable=too-many-public-methods
|
# pylint: disable=too-many-public-methods
|
||||||
"""Tests for certbot.storage."""
|
"""Tests for certbot._internal.storage."""
|
||||||
|
|
||||||
def test_initialization(self):
|
def test_initialization(self):
|
||||||
self.assertEqual(self.test_rc.lineagename, "example.org")
|
self.assertEqual(self.test_rc.lineagename, "example.org")
|
||||||
@@ -155,7 +155,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
the renewal configuration file doesn't end in ".conf"
|
the renewal configuration file doesn't end in ".conf"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
broken = os.path.join(self.config.config_dir, "broken.conf")
|
broken = os.path.join(self.config.config_dir, "broken.conf")
|
||||||
with open(broken, "w") as f:
|
with open(broken, "w") as f:
|
||||||
f.write("[No closing bracket for you!")
|
f.write("[No closing bracket for you!")
|
||||||
@@ -168,7 +168,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
def test_renewal_incomplete_config(self):
|
def test_renewal_incomplete_config(self):
|
||||||
"""Test that the RenewableCert constructor will complain if
|
"""Test that the RenewableCert constructor will complain if
|
||||||
the renewal configuration file is missing a required file element."""
|
the renewal configuration file is missing a required file element."""
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
config = configobj.ConfigObj()
|
config = configobj.ConfigObj()
|
||||||
config["cert"] = "imaginary_cert.pem"
|
config["cert"] = "imaginary_cert.pem"
|
||||||
# Here the required privkey is missing.
|
# Here the required privkey is missing.
|
||||||
@@ -180,23 +180,23 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
config.filename, self.config)
|
config.filename, self.config)
|
||||||
|
|
||||||
def test_no_renewal_version(self):
|
def test_no_renewal_version(self):
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
|
|
||||||
self._write_out_ex_kinds()
|
self._write_out_ex_kinds()
|
||||||
self.assertTrue("version" not in self.config_file)
|
self.assertTrue("version" not in self.config_file)
|
||||||
|
|
||||||
with mock.patch("certbot.storage.logger") as mock_logger:
|
with mock.patch("certbot._internal.storage.logger") as mock_logger:
|
||||||
storage.RenewableCert(self.config_file.filename, self.config)
|
storage.RenewableCert(self.config_file.filename, self.config)
|
||||||
self.assertFalse(mock_logger.warning.called)
|
self.assertFalse(mock_logger.warning.called)
|
||||||
|
|
||||||
def test_renewal_newer_version(self):
|
def test_renewal_newer_version(self):
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
|
|
||||||
self._write_out_ex_kinds()
|
self._write_out_ex_kinds()
|
||||||
self.config_file["version"] = "99.99.99"
|
self.config_file["version"] = "99.99.99"
|
||||||
self.config_file.write()
|
self.config_file.write()
|
||||||
|
|
||||||
with mock.patch("certbot.storage.logger") as mock_logger:
|
with mock.patch("certbot._internal.storage.logger") as mock_logger:
|
||||||
storage.RenewableCert(self.config_file.filename, self.config)
|
storage.RenewableCert(self.config_file.filename, self.config)
|
||||||
self.assertTrue(mock_logger.info.called)
|
self.assertTrue(mock_logger.info.called)
|
||||||
self.assertTrue("version" in mock_logger.info.call_args[0][0])
|
self.assertTrue("version" in mock_logger.info.call_args[0][0])
|
||||||
@@ -295,7 +295,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
self.assertEqual(self.test_rc.latest_common_version(), 17)
|
self.assertEqual(self.test_rc.latest_common_version(), 17)
|
||||||
self.assertEqual(self.test_rc.next_free_version(), 18)
|
self.assertEqual(self.test_rc.next_free_version(), 18)
|
||||||
|
|
||||||
@mock.patch("certbot.storage.logger")
|
@mock.patch("certbot._internal.storage.logger")
|
||||||
def test_ensure_deployed(self, mock_logger):
|
def test_ensure_deployed(self, mock_logger):
|
||||||
mock_update = self.test_rc.update_all_links_to = mock.Mock()
|
mock_update = self.test_rc.update_all_links_to = mock.Mock()
|
||||||
mock_has_pending = self.test_rc.has_pending_deployment = mock.Mock()
|
mock_has_pending = self.test_rc.has_pending_deployment = mock.Mock()
|
||||||
@@ -361,7 +361,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
real_unlink(path)
|
real_unlink(path)
|
||||||
|
|
||||||
self._write_out_ex_kinds()
|
self._write_out_ex_kinds()
|
||||||
with mock.patch("certbot.storage.os.unlink") as mock_unlink:
|
with mock.patch("certbot._internal.storage.os.unlink") as mock_unlink:
|
||||||
mock_unlink.side_effect = unlink_or_raise
|
mock_unlink.side_effect = unlink_or_raise
|
||||||
self.assertRaises(ValueError, self.test_rc.update_all_links_to, 12)
|
self.assertRaises(ValueError, self.test_rc.update_all_links_to, 12)
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
real_unlink(path)
|
real_unlink(path)
|
||||||
|
|
||||||
self._write_out_ex_kinds()
|
self._write_out_ex_kinds()
|
||||||
with mock.patch("certbot.storage.os.unlink") as mock_unlink:
|
with mock.patch("certbot._internal.storage.os.unlink") as mock_unlink:
|
||||||
mock_unlink.side_effect = unlink_or_raise
|
mock_unlink.side_effect = unlink_or_raise
|
||||||
self.assertRaises(ValueError, self.test_rc.update_all_links_to, 12)
|
self.assertRaises(ValueError, self.test_rc.update_all_links_to, 12)
|
||||||
|
|
||||||
@@ -423,8 +423,8 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
os.unlink(self.test_rc.cert)
|
os.unlink(self.test_rc.cert)
|
||||||
self.assertRaises(errors.CertStorageError, self.test_rc.names)
|
self.assertRaises(errors.CertStorageError, self.test_rc.names)
|
||||||
|
|
||||||
@mock.patch("certbot.storage.cli")
|
@mock.patch("certbot._internal.storage.cli")
|
||||||
@mock.patch("certbot.storage.datetime")
|
@mock.patch("certbot._internal.storage.datetime")
|
||||||
def test_time_interval_judgments(self, mock_datetime, mock_cli):
|
def test_time_interval_judgments(self, mock_datetime, mock_cli):
|
||||||
"""Test should_autorenew() on the basis of expiry time windows."""
|
"""Test should_autorenew() on the basis of expiry time windows."""
|
||||||
test_cert = test_util.load_vector("cert_512.pem")
|
test_cert = test_util.load_vector("cert_512.pem")
|
||||||
@@ -478,8 +478,8 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
self.test_rc.configuration["renewalparams"]["autorenew"] = "False"
|
self.test_rc.configuration["renewalparams"]["autorenew"] = "False"
|
||||||
self.assertFalse(self.test_rc.autorenewal_is_enabled())
|
self.assertFalse(self.test_rc.autorenewal_is_enabled())
|
||||||
|
|
||||||
@mock.patch("certbot.storage.cli")
|
@mock.patch("certbot._internal.storage.cli")
|
||||||
@mock.patch("certbot.storage.RenewableCert.ocsp_revoked")
|
@mock.patch("certbot._internal.storage.RenewableCert.ocsp_revoked")
|
||||||
def test_should_autorenew(self, mock_ocsp, mock_cli):
|
def test_should_autorenew(self, mock_ocsp, mock_cli):
|
||||||
"""Test should_autorenew on the basis of reasons other than
|
"""Test should_autorenew on the basis of reasons other than
|
||||||
expiry time window."""
|
expiry time window."""
|
||||||
@@ -496,7 +496,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
self.assertTrue(self.test_rc.should_autorenew())
|
self.assertTrue(self.test_rc.should_autorenew())
|
||||||
mock_ocsp.return_value = False
|
mock_ocsp.return_value = False
|
||||||
|
|
||||||
@mock.patch("certbot.storage.relevant_values")
|
@mock.patch("certbot._internal.storage.relevant_values")
|
||||||
def test_save_successor(self, mock_rv):
|
def test_save_successor(self, mock_rv):
|
||||||
# Mock relevant_values() to claim that all values are relevant here
|
# Mock relevant_values() to claim that all values are relevant here
|
||||||
# (to avoid instantiating parser)
|
# (to avoid instantiating parser)
|
||||||
@@ -560,7 +560,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
self.assertFalse(os.path.exists(temp_config_file))
|
self.assertFalse(os.path.exists(temp_config_file))
|
||||||
|
|
||||||
@test_util.skip_on_windows('Group/everybody permissions are not maintained on Windows.')
|
@test_util.skip_on_windows('Group/everybody permissions are not maintained on Windows.')
|
||||||
@mock.patch("certbot.storage.relevant_values")
|
@mock.patch("certbot._internal.storage.relevant_values")
|
||||||
def test_save_successor_maintains_group_mode(self, mock_rv):
|
def test_save_successor_maintains_group_mode(self, mock_rv):
|
||||||
# Mock relevant_values() to claim that all values are relevant here
|
# Mock relevant_values() to claim that all values are relevant here
|
||||||
# (to avoid instantiating parser)
|
# (to avoid instantiating parser)
|
||||||
@@ -581,8 +581,8 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
self.test_rc.save_successor(3, b"newcert", b"new_privkey", b"new chain", self.config)
|
self.test_rc.save_successor(3, b"newcert", b"new_privkey", b"new chain", self.config)
|
||||||
self.assertTrue(filesystem.check_mode(self.test_rc.version("privkey", 4), 0o600))
|
self.assertTrue(filesystem.check_mode(self.test_rc.version("privkey", 4), 0o600))
|
||||||
|
|
||||||
@mock.patch("certbot.storage.relevant_values")
|
@mock.patch("certbot._internal.storage.relevant_values")
|
||||||
@mock.patch("certbot.storage.filesystem.copy_ownership_and_apply_mode")
|
@mock.patch("certbot._internal.storage.filesystem.copy_ownership_and_apply_mode")
|
||||||
def test_save_successor_maintains_gid(self, mock_ownership, mock_rv):
|
def test_save_successor_maintains_gid(self, mock_ownership, mock_rv):
|
||||||
# Mock relevant_values() to claim that all values are relevant here
|
# Mock relevant_values() to claim that all values are relevant here
|
||||||
# (to avoid instantiating parser)
|
# (to avoid instantiating parser)
|
||||||
@@ -595,14 +595,14 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
self.test_rc.save_successor(2, b"newcert", b"new_privkey", b"new chain", self.config)
|
self.test_rc.save_successor(2, b"newcert", b"new_privkey", b"new chain", self.config)
|
||||||
self.assertTrue(mock_ownership.called)
|
self.assertTrue(mock_ownership.called)
|
||||||
|
|
||||||
@mock.patch("certbot.storage.relevant_values")
|
@mock.patch("certbot._internal.storage.relevant_values")
|
||||||
def test_new_lineage(self, mock_rv):
|
def test_new_lineage(self, mock_rv):
|
||||||
"""Test for new_lineage() class method."""
|
"""Test for new_lineage() class method."""
|
||||||
# Mock relevant_values to say everything is relevant here (so we
|
# Mock relevant_values to say everything is relevant here (so we
|
||||||
# don't have to mock the parser to help it decide!)
|
# don't have to mock the parser to help it decide!)
|
||||||
mock_rv.side_effect = lambda x: x
|
mock_rv.side_effect = lambda x: x
|
||||||
|
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
result = storage.RenewableCert.new_lineage(
|
result = storage.RenewableCert.new_lineage(
|
||||||
"the-lineage.com", b"cert", b"privkey", b"chain", self.config)
|
"the-lineage.com", b"cert", b"privkey", b"chain", self.config)
|
||||||
# This consistency check tests most relevant properties about the
|
# This consistency check tests most relevant properties about the
|
||||||
@@ -642,14 +642,14 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
# TODO: Conceivably we could test that the renewal parameters actually
|
# TODO: Conceivably we could test that the renewal parameters actually
|
||||||
# got saved
|
# got saved
|
||||||
|
|
||||||
@mock.patch("certbot.storage.relevant_values")
|
@mock.patch("certbot._internal.storage.relevant_values")
|
||||||
def test_new_lineage_nonexistent_dirs(self, mock_rv):
|
def test_new_lineage_nonexistent_dirs(self, mock_rv):
|
||||||
"""Test that directories can be created if they don't exist."""
|
"""Test that directories can be created if they don't exist."""
|
||||||
# Mock relevant_values to say everything is relevant here (so we
|
# Mock relevant_values to say everything is relevant here (so we
|
||||||
# don't have to mock the parser to help it decide!)
|
# don't have to mock the parser to help it decide!)
|
||||||
mock_rv.side_effect = lambda x: x
|
mock_rv.side_effect = lambda x: x
|
||||||
|
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
shutil.rmtree(self.config.renewal_configs_dir)
|
shutil.rmtree(self.config.renewal_configs_dir)
|
||||||
shutil.rmtree(self.config.default_archive_dir)
|
shutil.rmtree(self.config.default_archive_dir)
|
||||||
shutil.rmtree(self.config.live_dir)
|
shutil.rmtree(self.config.live_dir)
|
||||||
@@ -664,9 +664,9 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
self.assertTrue(os.path.exists(os.path.join(
|
self.assertTrue(os.path.exists(os.path.join(
|
||||||
self.config.default_archive_dir, "the-lineage.com", "privkey1.pem")))
|
self.config.default_archive_dir, "the-lineage.com", "privkey1.pem")))
|
||||||
|
|
||||||
@mock.patch("certbot.storage.util.unique_lineage_name")
|
@mock.patch("certbot._internal.storage.util.unique_lineage_name")
|
||||||
def test_invalid_config_filename(self, mock_uln):
|
def test_invalid_config_filename(self, mock_uln):
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
mock_uln.return_value = "this_does_not_end_with_dot_conf", "yikes"
|
mock_uln.return_value = "this_does_not_end_with_dot_conf", "yikes"
|
||||||
self.assertRaises(errors.CertStorageError,
|
self.assertRaises(errors.CertStorageError,
|
||||||
storage.RenewableCert.new_lineage, "example.com",
|
storage.RenewableCert.new_lineage, "example.com",
|
||||||
@@ -696,7 +696,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
self.assertFalse(self.test_rc.ocsp_revoked())
|
self.assertFalse(self.test_rc.ocsp_revoked())
|
||||||
|
|
||||||
def test_add_time_interval(self):
|
def test_add_time_interval(self):
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
|
|
||||||
# this month has 30 days, and the next year is a leap year
|
# this month has 30 days, and the next year is a leap year
|
||||||
time_1 = pytz.UTC.fromutc(datetime.datetime(2003, 11, 20, 11, 59, 21))
|
time_1 = pytz.UTC.fromutc(datetime.datetime(2003, 11, 20, 11, 59, 21))
|
||||||
@@ -751,7 +751,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
self.assertEqual(self.test_rc.is_test_cert, False)
|
self.assertEqual(self.test_rc.is_test_cert, False)
|
||||||
|
|
||||||
def test_missing_cert(self):
|
def test_missing_cert(self):
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
self.assertRaises(errors.CertStorageError,
|
self.assertRaises(errors.CertStorageError,
|
||||||
storage.RenewableCert,
|
storage.RenewableCert,
|
||||||
self.config_file.filename, self.config)
|
self.config_file.filename, self.config)
|
||||||
@@ -776,7 +776,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
archive_dir = "the_archive"
|
archive_dir = "the_archive"
|
||||||
relevant_data = {"useful": "new_value"}
|
relevant_data = {"useful": "new_value"}
|
||||||
|
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
storage.write_renewal_config(temp, temp2, archive_dir, target, relevant_data)
|
storage.write_renewal_config(temp, temp2, archive_dir, target, relevant_data)
|
||||||
|
|
||||||
with open(temp2, "r") as f:
|
with open(temp2, "r") as f:
|
||||||
@@ -794,7 +794,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
stat.S_IMODE(os.lstat(temp2).st_mode))
|
stat.S_IMODE(os.lstat(temp2).st_mode))
|
||||||
|
|
||||||
def test_update_symlinks(self):
|
def test_update_symlinks(self):
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
archive_dir_path = os.path.join(self.config.config_dir, "archive", "example.org")
|
archive_dir_path = os.path.join(self.config.config_dir, "archive", "example.org")
|
||||||
for kind in ALL_FOUR:
|
for kind in ALL_FOUR:
|
||||||
live_path = self.config_file[kind]
|
live_path = self.config_file[kind]
|
||||||
@@ -809,7 +809,7 @@ class RenewableCertTests(BaseRenewableCertTest):
|
|||||||
update_symlinks=True)
|
update_symlinks=True)
|
||||||
|
|
||||||
class DeleteFilesTest(BaseRenewableCertTest):
|
class DeleteFilesTest(BaseRenewableCertTest):
|
||||||
"""Tests for certbot.storage.delete_files"""
|
"""Tests for certbot._internal.storage.delete_files"""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(DeleteFilesTest, self).setUp()
|
super(DeleteFilesTest, self).setUp()
|
||||||
|
|
||||||
@@ -827,8 +827,8 @@ class DeleteFilesTest(BaseRenewableCertTest):
|
|||||||
self.config.config_dir, "archive", "example.org")))
|
self.config.config_dir, "archive", "example.org")))
|
||||||
|
|
||||||
def _call(self):
|
def _call(self):
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
with mock.patch("certbot.storage.logger"):
|
with mock.patch("certbot._internal.storage.logger"):
|
||||||
storage.delete_files(self.config, "example.org")
|
storage.delete_files(self.config, "example.org")
|
||||||
|
|
||||||
def test_delete_all_files(self):
|
def test_delete_all_files(self):
|
||||||
@@ -899,7 +899,7 @@ class DeleteFilesTest(BaseRenewableCertTest):
|
|||||||
self.assertFalse(os.path.exists(archive_dir))
|
self.assertFalse(os.path.exists(archive_dir))
|
||||||
|
|
||||||
class CertPathForCertNameTest(BaseRenewableCertTest):
|
class CertPathForCertNameTest(BaseRenewableCertTest):
|
||||||
"""Test for certbot.storage.cert_path_for_cert_name"""
|
"""Test for certbot._internal.storage.cert_path_for_cert_name"""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(CertPathForCertNameTest, self).setUp()
|
super(CertPathForCertNameTest, self).setUp()
|
||||||
self.config_file.write()
|
self.config_file.write()
|
||||||
@@ -909,7 +909,7 @@ class CertPathForCertNameTest(BaseRenewableCertTest):
|
|||||||
self.config.cert_path = (self.fullchain, '')
|
self.config.cert_path = (self.fullchain, '')
|
||||||
|
|
||||||
def _call(self, cli_config, certname):
|
def _call(self, cli_config, certname):
|
||||||
from certbot.storage import cert_path_for_cert_name
|
from certbot._internal.storage import cert_path_for_cert_name
|
||||||
return cert_path_for_cert_name(cli_config, certname)
|
return cert_path_for_cert_name(cli_config, certname)
|
||||||
|
|
||||||
def test_simple_cert_name(self):
|
def test_simple_cert_name(self):
|
||||||
|
@@ -22,8 +22,8 @@ from cryptography.hazmat.primitives import serialization
|
|||||||
from certbot import configuration
|
from certbot import configuration
|
||||||
from certbot import constants
|
from certbot import constants
|
||||||
from certbot import interfaces
|
from certbot import interfaces
|
||||||
from certbot import lock
|
from certbot._internal import lock
|
||||||
from certbot import storage
|
from certbot._internal import storage
|
||||||
from certbot import util
|
from certbot import util
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.compat import filesystem
|
from certbot.compat import filesystem
|
||||||
|
@@ -21,7 +21,7 @@ from acme.magic_typing import Tuple, Union # pylint: disable=unused-import, no-
|
|||||||
|
|
||||||
from certbot import constants
|
from certbot import constants
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot import lock
|
from certbot._internal import lock
|
||||||
from certbot.compat import os
|
from certbot.compat import os
|
||||||
from certbot.compat import filesystem
|
from certbot.compat import filesystem
|
||||||
|
|
||||||
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.account`
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.account
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.auth_handler`
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.auth_handler
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.cert_manager`
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.cert_manager
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.client`
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.client
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.error_handler`
|
|
||||||
--------------------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.error_handler
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.lock`
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.lock
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.main`
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.main
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.notify`
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.notify
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.ocsp`
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.ocsp
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.renewal`
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.renewal
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.reporter`
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.reporter
|
|
||||||
:members:
|
|
@@ -1,5 +0,0 @@
|
|||||||
:mod:`certbot.storage`
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
.. automodule:: certbot.storage
|
|
||||||
:members:
|
|
2
setup.py
2
setup.py
@@ -165,7 +165,7 @@ setup(
|
|||||||
|
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
'certbot = certbot.main:main',
|
'certbot = certbot._internal.main:main',
|
||||||
],
|
],
|
||||||
'certbot.plugins': [
|
'certbot.plugins': [
|
||||||
'manual = certbot.plugins.manual:Authenticator',
|
'manual = certbot.plugins.manual:Authenticator',
|
||||||
|
@@ -19,7 +19,7 @@ from cryptography.hazmat.backends import default_backend
|
|||||||
from cryptography.hazmat.primitives import serialization, hashes # type: ignore
|
from cryptography.hazmat.primitives import serialization, hashes # type: ignore
|
||||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||||
|
|
||||||
from certbot import lock
|
from certbot._internal import lock
|
||||||
from certbot import util
|
from certbot import util
|
||||||
from certbot.compat import filesystem
|
from certbot.compat import filesystem
|
||||||
|
|
||||||
|
@@ -147,7 +147,7 @@ files=run.bat
|
|||||||
renew-down.ps1
|
renew-down.ps1
|
||||||
|
|
||||||
[Command certbot]
|
[Command certbot]
|
||||||
entry_point=certbot.main:main
|
entry_point=certbot._internal.main:main
|
||||||
extra_preamble=pywin32_paths.py
|
extra_preamble=pywin32_paths.py
|
||||||
'''.format(certbot_version=certbot_version,
|
'''.format(certbot_version=certbot_version,
|
||||||
installer_suffix='win_amd64' if PYTHON_BITNESS == 64 else 'win32',
|
installer_suffix='win_amd64' if PYTHON_BITNESS == 64 else 'win32',
|
||||||
|
Reference in New Issue
Block a user