mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 16:22:18 -04:00
Fixing tests
This commit is contained in:
parent
7b2c2d3a48
commit
d38828751f
4 changed files with 16 additions and 4 deletions
|
|
@ -90,6 +90,8 @@ class AuthHandler(object):
|
|||
|
||||
my_authzr = self.authzr
|
||||
|
||||
logger.debug("authzr: %s", my_authzr)
|
||||
|
||||
returnDomains = []
|
||||
#Remove failing domains if best_effort is true
|
||||
for domain in domains:
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ def obtain_cert(config, plugins, lineage=None):
|
|||
if config.csr is not None:
|
||||
assert lineage is None, "Did not expect a CSR with a RenewableCert"
|
||||
csr, typ = config.actual_csr
|
||||
certr, chain = le_client.obtain_certificate_from_csr(config.domains, csr, typ)
|
||||
certr, chain = le_client.obtain_certificate_from_csr(config.domains, csr, False, typ)
|
||||
if config.dry_run:
|
||||
logger.info(
|
||||
"Dry run: skipping saving certificate to %s", config.cert_path)
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ class Client(object):
|
|||
else:
|
||||
self.auth_handler = None
|
||||
|
||||
def obtain_certificate_from_csr(self, domains, csr, authzr,
|
||||
def obtain_certificate_from_csr(self, domains, csr, authzr=False,
|
||||
typ=OpenSSL.crypto.FILETYPE_ASN1):
|
||||
"""Obtain certificate.
|
||||
|
||||
|
|
@ -222,10 +222,15 @@ class Client(object):
|
|||
|
||||
logger.debug("CSR: %s, domains: %s", csr, domains)
|
||||
|
||||
if authzr is False:
|
||||
authzr, _ = self.auth_handler.get_authorizations(
|
||||
domains,
|
||||
self.config.allow_subset_of_names)
|
||||
|
||||
certr = self.acme.request_issuance(
|
||||
jose.ComparableX509(
|
||||
OpenSSL.crypto.load_certificate_request(typ, csr.data)),
|
||||
authzr)
|
||||
authzr)
|
||||
return certr, self.acme.fetch_chain(certr)
|
||||
|
||||
def obtain_certificate(self, domains):
|
||||
|
|
|
|||
|
|
@ -137,9 +137,14 @@ class ClientTest(unittest.TestCase):
|
|||
self.assertRaises(errors.ConfigurationError,
|
||||
cli.HelpfulArgumentParser.handle_csr, mock_parser, mock_parsed_args)
|
||||
|
||||
authzr, _ = self.client.auth_handler.get_authorizations(self.eg_domains, False)
|
||||
|
||||
self.assertEqual(
|
||||
(mock.sentinel.certr, mock.sentinel.chain),
|
||||
self.client.obtain_certificate_from_csr(self.eg_domains, test_csr))
|
||||
self.client.obtain_certificate_from_csr(
|
||||
self.eg_domains,
|
||||
test_csr,
|
||||
authzr))
|
||||
# and that the cert was obtained correctly
|
||||
self._check_obtain_certificate()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue