mirror of
https://github.com/certbot/certbot.git
synced 2026-04-25 08:07:16 -04:00
Adding test for obtain_certificate_from_csr with auth_handler set to None
This commit is contained in:
parent
fe1ab15f4b
commit
8b7f72b5bc
1 changed files with 10 additions and 1 deletions
|
|
@ -127,8 +127,9 @@ class ClientTest(unittest.TestCase):
|
|||
self.acme.fetch_chain.assert_called_once_with(mock.sentinel.certr)
|
||||
|
||||
# FIXME move parts of this to test_cli.py...
|
||||
@mock.patch("letsencrypt.client.logger")
|
||||
@mock.patch("letsencrypt.cli._process_domain")
|
||||
def test_obtain_certificate_from_csr(self, mock_process_domain):
|
||||
def test_obtain_certificate_from_csr(self, mock_process_domain, mock_logger):
|
||||
self._mock_obtain_certificate()
|
||||
from letsencrypt import cli
|
||||
test_csr = le_util.CSR(form="der", file=None, data=CSR_SAN)
|
||||
|
|
@ -153,6 +154,14 @@ class ClientTest(unittest.TestCase):
|
|||
# and that the cert was obtained correctly
|
||||
self._check_obtain_certificate()
|
||||
|
||||
# Test for no auth_handler
|
||||
self.client.auth_handler = None
|
||||
self.assertRaises(
|
||||
errors.Error,
|
||||
self.client.obtain_certificate_from_csr,
|
||||
self.eg_domains,
|
||||
test_csr)
|
||||
mock_logger.warning.assert_called_once_with(mock.ANY)
|
||||
|
||||
@mock.patch("letsencrypt.client.crypto_util")
|
||||
def test_obtain_certificate(self, mock_crypto_util):
|
||||
|
|
|
|||
Loading…
Reference in a new issue