Expand "deep check and repair" test

This commit is contained in:
Sajith Sasidharan 2020-07-15 16:58:39 -04:00
parent 6969366370
commit 8fedbd52c2

View File

@ -20,6 +20,7 @@ from allmydata.interfaces import (
IServer,
ICheckResults,
IDeepCheckResults,
ICheckAndRepairResults,
)
from allmydata.util import base32
from allmydata.web import check_results as web_check_results
@ -126,6 +127,25 @@ class FakeDeepCheckResults(object):
return { FakeResults().get_corrupt_shares() }
@implementer(ICheckAndRepairResults)
class FakeDeepCheckAndRepairResults(object):
def get_storage_index(self):
return "<none>"
def get_pre_repair_results(self):
return FakeResults()
def get_post_repair_results(self):
return FakeResults()
def get_repair_attempted(self):
return True
def get_repair_successful(self):
return False
class WebResultsRendering(unittest.TestCase):
def remove_tags(self, s):
@ -495,8 +515,15 @@ class WebResultsRendering(unittest.TestCase):
def test_deep_check_and_repair_renderer(self):
monitor = Monitor()
status = check_results.DeepCheckAndRepairResults("")
status.add_check_and_repair(
FakeDeepCheckAndRepairResults(),
(u"some", u"fake", u"path")
)
monitor.set_status(status)
elem = web_check_results.DeepCheckAndRepairResultsRendererElement(monitor)
doc = self.render_element(elem)
soup = BeautifulSoup(doc, 'html5lib')