def test_render_GET_missingTemplate(self): """render_GET() with a missing template should raise an error and return the result of replaceErrorPage(). """ oldLookup = HTTPServer.lookup try: HTTPServer.lookup = None self.request.method = b'GET' page = self.captchaResource.render_GET(self.request) errorPage = HTTPServer.replaceErrorPage(Exception('kablam')) self.assertEqual(page, errorPage) finally: HTTPServer.lookup = oldLookup
def test_replaceErrorPage(self): """``replaceErrorPage`` should return the expected html.""" exc = Exception("vegan gümmibären") errorPage = HTTPServer.replaceErrorPage(exc) self.assertSubstring("Something went wrong", errorPage) self.assertNotSubstring("vegan gümmibären", errorPage)