コード例 #1
0
ファイル: test_HTTPServer.py プロジェクト: gsathya/bridgedb
 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
コード例 #2
0
 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
コード例 #3
0
ファイル: test_HTTPServer.py プロジェクト: gsathya/bridgedb
 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)
コード例 #4
0
 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)