mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:14:54 +02:00
cover test
This commit is contained in:
@@ -7,6 +7,7 @@ import shutil
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
import zope.component
|
import zope.component
|
||||||
|
|
||||||
from certbot import constants
|
from certbot import constants
|
||||||
|
|||||||
@@ -34,6 +34,20 @@ class ReverterCheckpointLocalTest(unittest.TestCase):
|
|||||||
|
|
||||||
logging.disable(logging.NOTSET)
|
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):
|
def test_basic_add_to_temp_checkpoint(self):
|
||||||
# These shouldn't conflict even though they are both named config.txt
|
# These shouldn't conflict even though they are both named config.txt
|
||||||
self.reverter.add_to_temp_checkpoint(self.sets[0], "save1")
|
self.reverter.add_to_temp_checkpoint(self.sets[0], "save1")
|
||||||
|
|||||||
Reference in New Issue
Block a user