Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErica Portnoy <ebportnoy@gmail.com>2022-10-14 23:56:16 +0300
committerErica Portnoy <ebportnoy@gmail.com>2022-10-14 23:56:16 +0300
commit0069961c834b123afd95c7dad895997f05eaa985 (patch)
treef8afe4a1b74a5f39f82bc0ae7fca5f652e804cde
parentcad3019a538971d9f4d66206f6418173a8c7410e (diff)
test that we don't modify the config if the dry run fails
-rw-r--r--certbot/tests/main_test.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/certbot/tests/main_test.py b/certbot/tests/main_test.py
index e326d819e..d5396659d 100644
--- a/certbot/tests/main_test.py
+++ b/certbot/tests/main_test.py
@@ -603,9 +603,19 @@ class ReconfigureTest(test_util.TempDirTestCase):
new_config = self._call('--cert-name example.com --deploy-hook'.split() + ['echo deploy'])
self.assertEqual(new_config['renewalparams']['renew_hook'], 'echo deploy')
- def test_no_domains(self):
- pass
+ def test_dry_run_fails(self):
+ # set side effect of raising error
+ self.mocks['_get_and_save_cert'].side_effect = errors.Error
+ try:
+ self._call('--cert-name example.com --apache'.split())
+ except errors.Error:
+ pass
+
+ # check that config isn't modified
+ with open(self.renewal_file, 'r') as f:
+ new_config = configobj.ConfigObj(f, encoding='utf-8', default_encoding='utf-8')
+ self.assertEqual(new_config['renewalparams']['authenticator'], 'nginx')
class DeleteIfAppropriateTest(test_util.ConfigTestCase):