def _fail_db_connection(self): doc = self.response.lxml_etree msg = webracer.utils.xpath_first(doc, '//strong[@style="color:red"]') if msg is not None: text = utils.text_content(msg) else: text = '(no message found)' self.fail("Database connection failed:\n%s" % text)
def assert_successish(self, session=None, check_errorbox=True): if session is None: session = self if session.response.code == 503: msg = 'Expected response to be successful, but was 503' if session.response.headers['content-type'].lower().startswith('text/html'): doc = session.response.lxml_etree if xpath_first(doc, '//title[text()="General Error"]') is not None: message = xpath_first_check(doc, '//h1[text()="General Error"]/..') text = utils.text_content(message) msg += "\n" + text self.fail(msg) session.assert_status(200) self.assert_no_php_spam(session) if check_errorbox: self.assert_no_phpbb_error(session)