def testDistillTxt(self):
        self.fp = rspreader.openlog(testdir + 'plaintext.mlog')
        result = distillML.distillTxt(self.fp, self.buf, {})
        self.assertEqual(0, result)

        # check content
        self.buf.seek(0)
        p = patterns_tester.checkPatterns(self.buf, ['Copyright', 'All rights reserved.', 'OF SUCH DAMAGE.'])
        self.assert_(not p, 'unexpected: %s' % p)
  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"))
        )