mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 11:02:49 +02:00
cover test
This commit is contained in:
@@ -7,6 +7,7 @@ import shutil
|
||||
import time
|
||||
import traceback
|
||||
|
||||
|
||||
import zope.component
|
||||
|
||||
from certbot import constants
|
||||
|
||||
@@ -34,6 +34,20 @@ class ReverterCheckpointLocalTest(unittest.TestCase):
|
||||
|
||||
logging.disable(logging.NOTSET)
|
||||
|
||||
@mock.patch("certbot.reverter.Reverter._read_and_append")
|
||||
def test_no_change(self, mock_read):
|
||||
mock_read.side_effect = OSError("cannot even")
|
||||
try:
|
||||
self.reverter.add_to_checkpoint(self.sets[0], "save1")
|
||||
except:
|
||||
pass
|
||||
self.reverter.finalize_checkpoint("blah")
|
||||
path = os.listdir(self.reverter.config.backup_dir)[0]
|
||||
no_change = os.path.join(self.reverter.config.backup_dir, path, "CHANGES_SINCE")
|
||||
with open(no_change, "r") as f:
|
||||
x = f.read()
|
||||
self.assertTrue("No changes" in x)
|
||||
|
||||
def test_basic_add_to_temp_checkpoint(self):
|
||||
# These shouldn't conflict even though they are both named config.txt
|
||||
self.reverter.add_to_temp_checkpoint(self.sets[0], "save1")
|
||||
|
||||
Reference in New Issue
Block a user