def checkPathForPattern(self, path, patterns): # note: look for </html> can ensure cgi did not abort in error buf = fileutil.aStringIO() app_httpserver.handlePath(path, buf) buf.seek(0) p = patterns_tester.checkPatterns(buf, patterns) self.assert_(not p, 'Test failed path:%s\n pattern not found: %s%s' % (path, p, patterns_tester.showFile(buf, 'out')) )
def checkPathForPattern(self, path, patterns, nopattern=None): # note: look for </html> can ensure cgi did not abort in error buf = fileutil.aStringIO() app_httpserver.handlePath(path, buf) buf.seek(0) p = patterns_tester.checkPatterns(buf.read(), patterns, nopattern) # BUG: p can also be nopattern. In this case the msg should be 'pattern found!' self.assert_( not p, "Test failed path:%s\n pattern not found: %s%s" % (path, p, patterns_tester.showFile(buf, "out")) )
def _run_url(self, path): """ Invoke the URL and return the response HTTP message """ buf = fileutil.aStringIO() app_httpserver.handlePath(path, buf) data = buf.getvalue() return data.decode('utf-8')