def test_deep_check_renderer(self): status = check_results.DeepCheckResults(b"fake-root-si") status.add_check( FakeCheckResults(b"<unhealthy/unrecoverable>", False, False), (u"fake", u"unhealthy", u"unrecoverable")) status.add_check( FakeCheckResults(b"<healthy/recoverable>", True, True), (u"fake", u"healthy", u"recoverable")) status.add_check( FakeCheckResults(b"<healthy/unrecoverable>", True, False), (u"fake", u"healthy", u"unrecoverable")) status.add_check( FakeCheckResults(b"<unhealthy/unrecoverable>", False, True), (u"fake", u"unhealthy", u"recoverable")) monitor = Monitor() monitor.set_status(status) elem = web_check_results.DeepCheckResultsRendererElement(monitor) doc = self.render_element(elem) soup = BeautifulSoup(doc, 'html5lib') assert_soup_has_favicon(self, soup) assert_soup_has_tag_with_content(self, soup, u"title", u"Tahoe-LAFS - Deep Check Results") assert_soup_has_tag_with_content(self, soup, u"h1", "Deep-Check Results for root SI=") assert_soup_has_tag_with_content(self, soup, u"li", u"Objects Checked: 4") assert_soup_has_tag_with_content(self, soup, u"li", u"Objects Healthy: 2") assert_soup_has_tag_with_content(self, soup, u"li", u"Objects Unhealthy: 2") assert_soup_has_tag_with_content(self, soup, u"li", u"Objects Unrecoverable: 2") assert_soup_has_tag_with_content(self, soup, u"li", u"Corrupt Shares: 4") assert_soup_has_tag_with_content( self, soup, u"h2", u"Files/Directories That Had Problems:") assert_soup_has_tag_with_content( self, soup, u"li", u"fake/unhealthy/recoverable: fake summary") assert_soup_has_tag_with_content( self, soup, u"li", u"fake/unhealthy/unrecoverable: fake summary") assert_soup_has_tag_with_content( self, soup, u"h2", u"Servers on which corrupt shares were found") assert_soup_has_tag_with_content(self, soup, u"h2", u"Corrupt Shares") assert_soup_has_tag_with_content(self, soup, u"h2", u"All Results")
def test_deep_check_and_repair_renderer(self): status = check_results.DeepCheckAndRepairResults("") status.add_check_and_repair( FakeCheckAndRepairResults("attempted/success", True, True), (u"attempted", u"success")) status.add_check_and_repair( FakeCheckAndRepairResults("attempted/failure", True, False), (u"attempted", u"failure")) status.add_check_and_repair( FakeCheckAndRepairResults("unattempted/failure", False, False), (u"unattempted", u"failure")) monitor = Monitor() monitor.set_status(status) elem = web_check_results.DeepCheckAndRepairResultsRendererElement( monitor) doc = self.render_element(elem) soup = BeautifulSoup(doc, 'html5lib') assert_soup_has_favicon(self, soup) assert_soup_has_tag_with_content(self, soup, u"title", u"Tahoe-LAFS - Deep Check Results") assert_soup_has_tag_with_content( self, soup, u"h1", u"Deep-Check-And-Repair Results for root SI=") assert_soup_has_tag_with_content(self, soup, u"li", u"Objects Checked: 3") assert_soup_has_tag_with_content( self, soup, u"li", u"Objects Healthy (before repair): 0") assert_soup_has_tag_with_content( self, soup, u"li", u"Objects Unhealthy (before repair): 3") assert_soup_has_tag_with_content(self, soup, u"li", u"Corrupt Shares (before repair): 3") assert_soup_has_tag_with_content(self, soup, u"li", u"Repairs Attempted: 2") assert_soup_has_tag_with_content(self, soup, u"li", u"Repairs Successful: 1") assert_soup_has_tag_with_content(self, soup, u"li", "Repairs Unsuccessful: 1") assert_soup_has_tag_with_content(self, soup, u"li", u"Objects Healthy (after repair): 0") assert_soup_has_tag_with_content( self, soup, u"li", u"Objects Unhealthy (after repair): 3") assert_soup_has_tag_with_content(self, soup, u"li", u"Corrupt Shares (after repair): 3") assert_soup_has_tag_with_content( self, soup, u"h2", u"Files/Directories That Had Problems:") assert_soup_has_tag_with_content( self, soup, u"h2", u"Files/Directories That Still Have Problems:") assert_soup_has_tag_with_content( self, soup, u"h2", u"Servers on which corrupt shares were found") assert_soup_has_tag_with_content(self, soup, u"h2", u"Remaining Corrupt Shares")
def test_status(self): """The monitor can have its status set.""" m = Monitor() self.assertEqual(m.get_status(), None) m.set_status("discombobulated") self.assertEqual(m.get_status(), "discombobulated")