Ejemplo n.º 1
0
    def test_literal(self):
        c = self.create_fake_client()
        lcr = web_check_results.LiteralCheckResultsRenderer(c)

        d = self.render1(lcr)

        def _check(html):
            s = self.remove_tags(html)
            self.failUnlessIn("Literal files are always healthy", s)

        d.addCallback(_check)
        d.addCallback(
            lambda ignored: self.render1(lcr, args={"return_to": ["FOOURL"]}))

        def _check_return_to(html):
            s = self.remove_tags(html)
            self.failUnlessIn("Literal files are always healthy", s)
            self.failUnlessIn('<a href="FOOURL">Return to file.</a>', html)

        d.addCallback(_check_return_to)
        d.addCallback(lambda ignored: self.render_json(lcr))

        def _check_json(js):
            j = json.loads(js)
            self.failUnlessEqual(j["storage-index"], "")
            self.failUnlessEqual(j["results"]["healthy"], True)

        d.addCallback(_check_json)
        return d
Ejemplo n.º 2
0
    def test_literal(self):
        lcr = web_check_results.LiteralCheckResultsRendererElement()

        html = self.render_element(lcr)
        self.failUnlessIn("Literal files are always healthy", html)

        html = self.render_element(lcr, args={"return_to": ["FOOURL"]})
        self.failUnlessIn("Literal files are always healthy", html)
        self.failUnlessIn('<a href="FOOURL">Return to file.</a>', html)

        c = self.create_fake_client()
        lcr = web_check_results.LiteralCheckResultsRenderer(c)

        js = self.render_json(lcr)
        j = json.loads(js)
        self.failUnlessEqual(j["storage-index"], "")
        self.failUnlessEqual(j["results"]["healthy"], True)