changeset 267:0dbc8b79a810

Added formatter test which renders SyntaxReference. imported from: moin--main--1.5--patch-270
author Alexander Schremmer <alex@alexanderweb.de.tla>
date Fri, 02 Dec 2005 10:38:53 +0000
parents 1fb19804a4b9
children 130bd0403e21
files MoinMoin/_tests/test_formatter.py
diffstat 1 files changed, 46 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/_tests/test_formatter.py	Fri Dec 02 10:38:53 2005 +0000
@@ -0,0 +1,46 @@
+# -*- 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 StringIO import StringIO
+from MoinMoin._tests import TestConfig
+from MoinMoin.Page import Page
+from MoinMoin.parser.wiki import Parser
+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
+            
+            try:
+                formatter = wikiutil.importPlugin(self.request.cfg, "formatter", f_name, "Formatter")
+            except wikiutil.PluginAttributeError:
+                pass
+            else:
+                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.
+        """
+
+        self.request.reset()
+        page = Page(self.request, pagename, formatter=formatter)
+        self.request.formatter = page.formatter = formatter(self.request)
+        #page.formatter.setPage(page)
+        #page.hilite_re = None
+        
+        return self.request.redirectedOutput(page.send_page, self.request)
+    
\ No newline at end of file