view MoinMoin/_tests/ @ 1973:4495ff257334

minor CHANGES changes
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 09 Apr 2007 01:47:48 +0200
parents 6dd2e29acffe
children 1339d6fdc4ff
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - MoinMoin.formatter.* Tests

    @copyright: 2005 by MoinMoin:AlexanderSchremmer
    @license: GNU GPL, see COPYING for details.

from unittest import TestCase
import re

from MoinMoin._tests import TestConfig
from MoinMoin.Page import Page
from MoinMoin import wikiutil

class FormatterTestCase(TestCase):
    def testSyntaxReference(self):
        formatters = wikiutil.getPlugins("formatter", self.request.cfg)
        for f_name in formatters:
            #if f_name in ('dom_xml', ):
            #    continue
                formatter = wikiutil.importPlugin(self.request.cfg, "formatter", f_name, "Formatter")
            except wikiutil.PluginAttributeError:
                print "Formatting using %r" % formatter
                self.formatPage("SyntaxReference", formatter)
                print "Done."

    def formatPage(self, pagename, formatter):
        """Parse a page. Should not raise an exception if the API of the
        formatter is correct.

        page = Page(self.request, pagename, formatter=formatter)
        self.request.formatter = page.formatter = formatter(self.request)
        #page.hilite_re = None

        return self.request.redirectedOutput(page.send_page)