changeset 2270:1a2c91fa17a5

tests: move them to /_tests/
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 01 Jul 2007 02:43:32 +0200
parents 9f9a79d5a8d9
children 7f703eba4403
files MoinMoin/_tests/test_converter_text_html_text_moin_wiki.py MoinMoin/_tests/test_formatter.py MoinMoin/_tests/test_macro.py MoinMoin/_tests/test_mail_sendmail.py MoinMoin/_tests/test_request.py MoinMoin/_tests/test_search.py MoinMoin/_tests/test_security.py MoinMoin/_tests/test_widget_html.py MoinMoin/_tests/test_wikixml_marshal.py MoinMoin/_tests/test_xmlrpc_multicall.py MoinMoin/converter/_tests/test_text_html_text_moin_wiki.py MoinMoin/formatter/_tests/test_formatter.py MoinMoin/macro/_tests/test_macro.py MoinMoin/mail/_tests/test_sendmail.py MoinMoin/request/_tests/test_request.py MoinMoin/search/_tests/test_search.py MoinMoin/security/_tests/test_security.py MoinMoin/widget/_tests/test_html.py MoinMoin/wikixml/_tests/test_marshal.py MoinMoin/xmlrpc/_tests/test_multicall.py
diffstat 20 files changed, 1948 insertions(+), 1948 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_converter_text_html_text_moin_wiki.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1136 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-MoinMoin - MoinMoin.text_html_text_moin_wiki Tests
-
-@copyright: 2005 by Bastian Blank, ThomasWaldmann
-@license: GNU GPL, see COPYING for details.
-"""
-
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
-
-import py
-py.test.skip("Many broken tests, much broken code, broken, broken, broken.")
-
-from cStringIO import StringIO
-from MoinMoin.converter import text_html_text_moin_wiki as converter
-from MoinMoin.parser.text_moin_wiki import Parser
-from MoinMoin.formatter.text_gedit import Formatter
-from MoinMoin.request import Clock
-from MoinMoin.error import ConvertError
-
-convert = converter.convert
-error = ConvertError
-
-
-class TestBase(unittest.TestCase):
-
-    def setUp(self):
-        self.cfg = self.TestConfig(bang_meta=True)
-        
-    def tearDown(self):
-        del self.cfg
-
-    def do_convert_real(self, func_args, successful=True):
-        try:
-            ret = convert(*func_args)
-        except error, e:
-            if successful:
-                self.fail("fails with parse error: %s" % e)
-            else:
-                return
-        if successful:
-            return ret
-        else:
-            self.fail("doesn't fail with parse error")
-
-
-class MinimalPage(object):
-    def __init__(self):
-        self.hilite_re = None
-        self.page_name = "testpage"
-
-
-class MinimalRequest(object):
-    # TODO: do we really need this class? no other test uses a request replacement.
-
-    def __init__(self, request):
-        self.request = request
-        self.clock = Clock()
-        
-        # This is broken - tests that need correct content_lang will fail
-        self.content_lang = None
-        self.current_lang = None
-        
-        self.form = {}
-        self._page_headings = {}
-        self.result = []
-
-    def getText(self, text, formatted=True):
-        return text
-
-    def write(self, text):
-        self.result.append(text)
-
-    def __getattr__(self, name):
-        return getattr(self.request, name)
-
-
-class TestConvertBlockRepeatable(TestBase):
-    def do(self, text, output):
-        text = text.lstrip('\n')
-        output = output.strip('\n')
-        request = MinimalRequest(self.request)
-        page = MinimalPage()
-        formatter = Formatter(request)
-        formatter.setPage(page)
-        Parser(text, request).format(formatter)
-        repeat = ''.join(request.result).strip('\n')
-        self.failUnlessEqual(repeat, output)
-        out = self.do_convert_real([request, page.page_name, repeat])
-        self.failUnlessEqual(text, out)
-
-    def testComment01(self):
-        test = ur"""
-##test
-"""
-        output = u"""<pre class="comment">\n##test</pre>"""
-        self.do(test, output)
-
-    def testComment02(self):
-        test = ur"""
-##test
-##test
-"""
-        output = u"""
-<pre class="comment">\n##test</pre>
-<pre class="comment">\n##test</pre>
-"""
-        self.do(test, output)
-
-    def testHeading01(self):
-        test = ur"""
-= test1 =
-
-"""
-        output = ur"""
-<h2>test1</h2>
-"""
-        self.do(test, output)
-
-    def testHeading02(self):
-        test = ur"""
-= test1 =
-
-== test2 ==
-
-"""
-        output = ur"""
-<h2>test1</h2>
-<h3>test2</h3>
-"""
-        self.do(test, output)
-
-    def testListSuccess01(self):
-        test = ur"""
- * test
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testListSuccess02(self):
-        test = ur"""
- 1. test
-
-"""
-        output = ur"""
-<ol type="1">
-<li><p>test </p>
-</li>
-</ol>
-"""
-        self.do(test, output)
-
-    def testListSuccess03(self):
-        test = ur"""
- test:: test
-
-"""
-        output = ur"""
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-"""
-        self.do(test, output)
-
-    def testListSuccess04(self):
-        test = ur"""
- * test
- * test
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-</li>
-<li><p>test </p>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testListSuccess05(self):
-        test = ur"""
- 1. test
- 1. test
-
-"""
-        output = ur"""
-<ol type="1">
-<li><p>test </p>
-</li>
-<li><p>test </p>
-</li>
-</ol>
-"""
-        self.do(test, output)
-
-    def testListSuccess06(self):
-        test = ur"""
- test:: test
- test:: test
-
-"""
-        output = ur"""
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-"""
-        self.do(test, output)
-
-    def testListSuccess07(self):
-        test = ur"""
- * test
-  
- * test
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testListSuccess08(self):
-        test = ur"""
- 1. test
-  
- 1. test
-
-"""
-        output = ur"""
-<ol type="1">
-<li><p>test </p>
-</li>
-</ol>
-<ol type="1">
-<li><p>test </p>
-</li>
-</ol>
-"""
-        self.do(test, output)
-
-    def testListSuccess09(self):
-        test = ur"""
- test:: test
-  
- test:: test
-
-"""
-        output = ur"""
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-"""
-        self.do(test, output)
-
-    def testListSuccess10(self):
-        test = ur"""
- * test
-  * test
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testListSuccess11(self):
-        test = ur"""
- 1. test
-  1. test
-
-"""
-        output = ur"""
-<ol type="1">
-<li><p>test </p>
-<ol type="1">
-<li><p>test </p>
-</li>
-</ol>
-</li>
-</ol>
-"""
-        self.do(test, output)
-
-    def testListSuccess12(self):
-        test = ur"""
- test:: test
-  test:: test
-
-"""
-        output = ur"""
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-</dd>
-</dl>
-"""
-        self.do(test, output)
-
-    def testListSuccess13(self):
-        test = ur"""
- * test
-  * test
- * test
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-</li>
-<li><p>test </p>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testListSuccess14(self):
-        test = ur"""
- 1. test
-  1. test
- 1. test
-
-"""
-        output = ur"""
-<ol type="1">
-<li><p>test </p>
-<ol type="1">
-<li><p>test </p>
-</li>
-</ol>
-</li>
-<li><p>test </p>
-</li>
-</ol>
-"""
-        self.do(test, output)
-
-    def testListSuccess15(self):
-        test = ur"""
- test:: test
-  test:: test
- test:: test
-
-"""
-        output = ur"""
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-</dd>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-"""
-        self.do(test, output)
-
-    def testListSuccess16(self):
-        test = ur"""
- * test
-
- 1. test
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-<ol type="1">
-<li><p>test </p>
-</li>
-</ol>
-"""
-        self.do(test, output)
-
-    def testListSuccess17(self):
-        test = ur"""
- * test
-
- test:: test
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-"""
-        self.do(test, output)
-
-    def testListSuccess18(self):
-        test = ur"""
- 1. test
-
- * test
-
-"""
-        output = ur"""
-<ol type="1">
-<li><p>test </p>
-</li>
-</ol>
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testListSuccess19(self):
-        test = ur"""
- 1. test
-
- test:: test
-
-"""
-        output = ur"""
-<ol type="1">
-<li><p>test </p>
-</li>
-</ol>
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-"""
-        self.do(test, output)
-
-    def testListSuccess20(self):
-        test = ur"""
- test:: test
-
- * test
-
-"""
-        output = ur"""
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testListSuccess21(self):
-        test = ur"""
- test:: test
-
- 1. test
-
-"""
-        output = ur"""
-<dl>
-<dt>test</dt>
-<dd><p>test </p>
-</dd>
-</dl>
-<ol type="1">
-<li><p>test </p>
-</li>
-</ol>
-"""
-        self.do(test, output)
-
-    def testListSuccess23(self):
-        test = ur"""
- 1. test
-  * test
-
-"""
-        output = ur"""
-<ol type="1">
-<li><p>test </p>
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-</li>
-</ol>
-"""
-        self.do(test, output)
-
-    def testListSuccess26(self):
-        test = ur"""
- * test
-
-test
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-<p>test </p>
-"""
-        self.do(test, output)
-
-    def testListSuccess28(self):
-        test = ur"""
- * test
-
- test
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-<p>test </p>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testListSuccess29(self):
-        test = ur"""
- * test
-  * test
- test
-"""
-        output = ur"""
-"""
-        self.do(test, output)
-
-    def testListSuccess30(self):
-        test = ur"""
- * test
-  * test
-  test
-"""
-        output = ur"""
-"""
-        self.do(test, output)
-
-    def testParagraph1(self):
-        test = ur"""
-test
-
-"""
-        output = ur"""
-<p>test </p>
-"""
-        self.do(test, output)
-
-    def testParagraph2(self):
-        test = ur"""
-test
-
-test
-
-"""
-        output = ur"""
-<p>test </p>
-<p>test </p>
-"""
-        self.do(test, output)
-
-    def testPreSuccess1(self):
-        test = ur"""
-{{{
-test
-}}}
-
-"""
-        output = ur"""
-<pre>
-test
-</pre>
-"""
-        self.do(test, output)
-
-    def testPreSuccess2(self):
-        test = ur"""
-{{{
-test
-test
-}}}
-
-"""
-        output = ur"""
-<pre>
-test
-test
-</pre>
-"""
-        self.do(test, output)
-
-    def testPreSuccess3(self):
-        test = ur"""
-{{{
-test
-
-test
-}}}
-
-"""
-        output = ur"""
-<pre>
-test
-
-test
-</pre>
-"""
-        self.do(test, output)
-
-    def testPreSuccess4(self):
-        test = ur"""
-{{{
- * test
-}}}
-
-"""
-        output = ur"""
-<pre>
- * test
-</pre>
-"""
-        self.do(test, output)
-
-    def testPreSuccess5(self):
-        test = ur"""
-{{{
-  }}}
-
-"""
-        output = ur"""
-<pre>
-  </pre>
-"""
-        self.do(test, output)
-
-    def testPreSuccess6(self):
-        test = ur"""
- * {{{
-test
-}}}
-
-"""
-        output = ur"""
-<ul>
-<li>
-<pre>
-test
-</pre>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testPreSuccess7(self):
-        test = ur"""
- * {{{
-   test
-   }}}
-
-"""
-        output = ur"""
-<ul>
-<li>
-<pre>
-   test
-   </pre>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testPreSuccess8(self):
-        test = ur"""
- * test
- {{{
-test
-}}}
-
-"""
-        output = ur"""
-<ul>
-<li><p>test 
-</p>
-<pre>
-test
-</pre>
-</li>
-</ul>
-"""
-        self.do(test, output)
-
-    def testPreSuccess9(self):
-        test = ur"""
- * test
-
-{{{
-test
-}}}
-
-"""
-        output = ur"""
-<ul>
-<li><p>test </p>
-</li>
-</ul>
-
-<pre>
-test
-</pre>
-"""
-        self.do(test, output)
-
-    def testRule1(self):
-        test = ur"""
-----
-
-"""
-        output = ur"""
-<hr/>
-"""
-        self.do(test, output)
-
-    def testTable01(self):
-        test = ur"""
-|| ||
-
-"""
-        output = ur"""
-<div>
-<table>
-<tr>
-<td>
-<p> </p>
-</td>
-</tr>
-</table>
-</div>
-"""
-        self.do(test, output)
-
-    def testTable02(self):
-        test = ur"""
-||test||
-
-"""
-        output = ur"""
-<div>
-<table>
-<tr>
-<td>
-<p>test</p>
-</td>
-</tr>
-</table>
-</div>
-"""
-        self.do(test, output)
-
-    def testTable03(self):
-        test = ur"""
-||test||test||
-
-"""
-        output = ur"""
-<div>
-<table>
-<tr>
-<td>
-<p>test</p>
-</td>
-<td>
-<p>test</p>
-</td>
-</tr>
-</table>
-</div>
-"""
-        self.do(test, output)
-
-    def testTable04(self):
-        test = ur"""
-||test||
-||test||test||
-
-"""
-        output = ur"""
-<div>
-<table>
-<tr>
-<td>
-<p>test</p>
-</td>
-</tr>
-<tr>
-<td>
-<p>test</p>
-</td>
-<td>
-<p>test</p>
-</td>
-</tr>
-</table>
-</div>
-"""
-        self.do(test, output)
-
-    def testTable05(self):
-        test = ur"""
-||||test||
-||test||test||
-
-"""
-        output = ur"""
-<div>
-<table>
-<tr>
-<td colspan="2" style="text-align: center;">
-<p>test</p>
-</td>
-</tr>
-<tr>
-<td>
-<p>test</p>
-</td>
-<td>
-<p>test</p>
-</td>
-</tr>
-</table>
-</div>
-"""
-        self.do(test, output)
-
-    def testTable06(self):
-        test = ur"""
-||||test||test||
-||test||||test||
-
-"""
-        output = ur"""
-<div>
-<table>
-<tr>
-<td colspan="2" style="text-align: center;">
-<p>test</p>
-</td>
-<td>
-<p>test</p>
-</td>
-</tr>
-<tr>
-<td>
-<p>test</p>
-</td>
-<td colspan="2" style="text-align: center;">
-<p>test</p>
-</td>
-</tr>
-</table>
-</div>
-"""
-        self.do(test, output)
-
-class TestConvertInlineFormatRepeatable(TestBase):
-    def do(self, text, output):
-        text = text.lstrip('\n')
-        output = output.strip('\n')
-        output = "<p>%s </p>" % output
-        request = MinimalRequest(self.request)
-        page = MinimalPage()
-        formatter = Formatter(request)
-        formatter.setPage(page)
-        Parser(text, request).format(formatter)
-        repeat = ''.join(request.result).strip('\n')
-        self.failUnlessEqual(repeat, output)
-        out = self.do_convert_real([request, page.page_name, repeat])
-        out = out.rstrip('\n')
-        self.failUnlessEqual(text, out)
-
-    def testEmphasis01(self):
-        test = ur"''test''"
-        output = ur"<em>test</em>"
-        self.do(test, output)
-
-    def testEmphasis02(self):
-        test = ur"'''test'''"
-        output = ur"<strong>test</strong>"
-        self.do(test, output)
-
-    def testEmphasis03(self):
-        test = ur"'''''test'''''"
-        output = ur"<em><strong>test</strong></em>"
-        self.do(test, output)
-
-    def testEmphasis04(self):
-        test = ur"''test'''test'''''"
-        output = ur"<em>test<strong>test</strong></em>"
-        self.do(test, output)
-
-    def testEmphasis05(self):
-        test = ur"'''test''test'''''"
-        output = ur"<strong>test<em>test</em></strong>"
-        self.do(test, output)
-
-    def testEmphasis06(self):
-        test = ur"''test'''test'''test''"
-        output = ur"<em>test<strong>test</strong>test</em>"
-        self.do(test, output)
-
-    def testEmphasis07(self):
-        test = ur"'''test''test''test'''"
-        output = ur"<strong>test<em>test</em>test</strong>"
-        self.do(test, output)
-
-    def testEmphasis08(self):
-        test = ur"''test'''''test'''"
-        output = ur"<em>test</em><strong>test</strong>"
-        self.do(test, output)
-
-    def testEmphasis09(self):
-        test = ur"'''test'''''test''"
-        output = ur"<strong>test</strong><em>test</em>"
-        self.do(test, output)
-
-    def testEmphasis10(self):
-        test = ur"'''''test''test'''"
-        output = ur"<strong><em>test</em>test</strong>"
-        self.do(test, output)
-
-    def testEmphasis11(self):
-        test = ur"'''''test'''test''"
-        output = ur"<em><strong>test</strong>test</em>"
-        self.do(test, output)
-
-    def testFormatBig01(self):
-        test = ur"~+test+~"
-        output = ur"<big>test</big>"
-        self.do(test, output)
-
-    def testFormatSmall01(self):
-        test = ur"~-test-~"
-        output = ur"<small>test</small>"
-        self.do(test, output)
-
-    def testFormatStrike01(self):
-        test = ur"--(test)--"
-        output = ur"<strike>test</strike>"
-        self.do(test, output)
-
-    def testFormatSub01(self):
-        test = ur",,test,,"
-        output = ur"<sub>test</sub>"
-        self.do(test, output)
-
-    def testFormatSup01(self):
-        test = ur"^test^"
-        output = ur"<sup>test</sup>"
-        self.do(test, output)
-
-    def testFormatUnderline01(self):
-        test = ur"__test__"
-        output = ur"<u>test</u>"
-        self.do(test, output)
-
-    def testPre01(self):
-        test = ur"{{{test}}}"
-        output = ur"<tt>test</tt>"
-        self.do(test, output)
-
-    def testWhitespace01(self):
-        test = ur"''test '''test'''''"
-        output = ur"<em>test <strong>test</strong></em>"
-        self.do(test, output)
-
-class TestConvertInlineItemRepeatable(TestBase):
-    def do(self, text, output):
-        text = text.lstrip('\n')
-        output = output.strip('\n')
-        output = "<p>%s </p>" % output
-        request = MinimalRequest(self.request)
-        page = MinimalPage()
-        formatter = Formatter(request)
-        formatter.setPage(page)
-        Parser(text, request).format(formatter)
-        repeat = ''.join(request.result).strip('\n')
-        self.failUnlessEqual(repeat, output)
-        out = self.do_convert_real([request, page.page_name, repeat])
-        out = out.rstrip('\n')
-        self.failUnlessEqual(text, out)
-
-    def testWikiWord01(self):
-        test = ur"WikiWord"
-        output = ur"""<a class="nonexistent" href="./WikiWord">WikiWord</a>"""
-        self.do(test, output)
-
-    def testNoWikiWord01(self):
-        test = ur"!WikiWord"
-        output = ur"WikiWord"
-        self.do(test, output)
-
-    def testSmiley01(self):
-        test = ur":-)"
-        output = ur"""<img src="/wiki/modern/img/smile.png" alt=":-)" height="15" width="15">"""
-        self.do(test, output)
-
-class TestStrip(unittest.TestCase):
-    def do(self, cls, text, output):
-        tree = converter.parse(text)
-        cls().do(tree)
-        out = StringIO()
-        try:
-            import xml.dom.ext
-        except ImportError:
-            py.test.skip('xml.dom.ext module is not available')
-        xml.dom.ext.Print(tree, out)
-        self.failUnlessEqual("<?xml version='1.0' encoding='UTF-8'?>%s" % output, out.getvalue().decode("utf-8"))
-
-class TestStripWhitespace(TestStrip):
-    def do(self, text, output):
-        super(TestStripWhitespace, self).do(converter.strip_whitespace, text, output)
-
-    def test1(self):
-        test = ur"""
-<t/>
-"""
-        output = ur"""<t/>"""
-        self.do(test, output)
-
-    def test2(self):
-        test = ur"""
-<t>
-  <z/>
-</t>
-"""
-        output = ur"""<t><z/></t>"""
-        self.do(test, output)
-
-    def test3(self):
-        test = ur"""
-<t>
-  <z>test</z>
-</t>
-"""
-        output = ur"""<t><z>test</z></t>"""
-        self.do(test, output)
-
-    def test4(self):
-        test = ur"""<p>&nbsp;</p>"""
-        output = ur""""""
-        self.do(test, output)
-
-    def test5(self):
-        test = ur"""<p>test </p>"""
-        output = ur"""<p>test</p>"""
-        self.do(test, output)
-
-class TestConvertBrokenBrowser(TestBase):
-    def do(self, text, output):
-        text = text.strip('\n')
-        output = output.lstrip('\n')
-        request = MinimalRequest(self.request)
-        page = MinimalPage()
-        out = self.do_convert_real([request, page.page_name, text])
-        self.failUnlessEqual(output, out)
-
-    def testList01(self):
-        test = ur"""
-<ul>
-<li>test</li>
-<ul>
-<li>test</li>
-</ul>
-<li>test</li>
-</ul>
-"""
-        output = ur"""
- * test
-  * test
- * test
-
-"""
-        self.do(test, output)
-
--- a/MoinMoin/_tests/test_formatter.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - MoinMoin.formatter.* Tests
-
-    @copyright: 2005 by MoinMoin:AlexanderSchremmer
-    @license: GNU GPL, see COPYING for details.
-"""
-
-import py
-
-import re
-
-from MoinMoin.Page import Page
-from MoinMoin import wikiutil
-
-
-class TestFormatter:
-    def testSyntaxReferenceDomXml(self):
-        py.test.skip("dom_xml formatter is known to be broken")
-        f_name = 'dom_xml'
-        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 testSyntaxReferenceDocBook(self):
-        py.test.skip("breaks with an attribute error, it should be checked whether the formatter on the DB branch is broken as well")
-        try:
-            from xml.dom import getDOMImplementation
-            dom = getDOMImplementation("4DOM")
-        except ImportError:
-            # if we don't have 4suite installed, the docbook formatter would just raise an exception
-            py.test.skip("not testing docbook formatter because no 4suite installed")
-        else:
-            f_name = 'text_docbook'
-            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 testSyntaxReferenceOthers(self):
-        formatters = wikiutil.getPlugins("formatter", self.request.cfg)
-
-        # we have separate tests for those:
-        formatters.remove('text_docbook')
-        formatters.remove('dom_xml')
-
-        for f_name in formatters:
-            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, content_only=1)
-
--- a/MoinMoin/_tests/test_macro.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - MoinMoin.macro Tests
-
-    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>,
-                2006 MoinMoin:ThomasWaldmann
-    @license: GNU GPL, see COPYING for details.
-"""
-
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
-
-from MoinMoin import macro
-from MoinMoin.parser.text import Parser
-from MoinMoin.formatter.text_html import Formatter
-
-
-class TestMacro(unittest.TestCase):
-    def testTrivialMacro(self):
-        """macro: trivial macro works"""
-        m = self._make_macro()
-        expected = m.formatter.linebreak(0)
-        result = m.execute("BR", "")
-        self.assertEqual(result, expected,
-            'Expected "%(expected)s" but got "%(result)s"' % locals())
-
-    def _make_macro(self):
-        """Test helper"""
-        p = Parser("##\n", self.request)
-        p.formatter = Formatter(self.request)
-        self.request.formatter = p.formatter
-        p.form = self.request.form
-        m = macro.Macro(p)
-        return m
-
--- a/MoinMoin/_tests/test_mail_sendmail.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-    MoinMoin - MoinMoin.mail.sendmail Tests
-
-    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>
-    @license: GNU GPL, see COPYING for details.
-"""
-
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
-from email.Charset import Charset, QP
-from email.Header import Header
-from MoinMoin.mail import sendmail
-from MoinMoin import config
-
-
-class TestdecodeSpamSafeEmail(unittest.TestCase):
-    """mail.sendmail: testing mail"""
-
-    _tests = (
-        ('', ''),
-        ('AT', '@'),
-        ('DOT', '.'),
-        ('DASH', '-'),
-        ('CAPS', ''),
-        ('Mixed', 'Mixed'),
-        ('lower', 'lower'),
-        ('Firstname DOT Lastname AT example DOT net',
-         'Firstname.Lastname@example.net'),
-        ('Firstname . Lastname AT exa mp le DOT n e t',
-         'Firstname.Lastname@example.net'),
-        ('Firstname I DONT WANT SPAM . Lastname@example DOT net',
-         'Firstname.Lastname@example.net'),
-        ('First name I Lastname DONT AT WANT SPAM example DOT n e t',
-         'FirstnameLastname@example.net'),
-        ('first.last@example.com', 'first.last@example.com'),
-        ('first . last @ example . com', 'first.last@example.com'),
-        )
-
-    def testDecodeSpamSafeMail(self):
-        """mail.sendmail: decoding spam safe mail"""
-        for coded, expected in self._tests:
-            result = sendmail.decodeSpamSafeEmail(coded)
-            self.assertEqual(result, expected,
-                             'Expected "%(expected)s" but got "%(result)s"' %
-                             locals())
-
-
-class TestEncodeAddress(unittest.TestCase):
-    """ Address encoding tests
-    
-    See http://www.faqs.org/rfcs/rfc2822.html section 3.4. 
-    Address Specification.
-            
-    mailbox     =   name-addr / addr-spec
-    name-addr   =   [display-name] angle-addr
-    angle-addr  =   [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
-    """
-    charset = Charset(config.charset)
-    charset.header_encoding = QP
-    charset.body_encoding = QP
-
-    def testSimpleAddress(self):
-        """ mail.sendmail: encode simple address: local@domain """
-        address = u'local@domain'
-        expected = address.encode(config.charset)
-        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
-                             expected)
-
-    def testComposite(self):
-        """ mail.sendmail: encode address: 'Phrase <local@domain>' """
-        address = u'Phrase <local@domain>'
-        phrase = str(Header(u'Phrase '.encode('utf-8'), self.charset))
-        expected = phrase + '<local@domain>'
-        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
-                             expected)
-
-    def testCompositeUnicode(self):
-        """ mail.sendmail: encode Uncode address: 'ויקי <local@domain>' """
-        address = u'ויקי <local@domain>'
-        phrase = str(Header(u'ויקי '.encode('utf-8'), self.charset))
-        expected = phrase + '<local@domain>'
-        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
-                             expected)
-
-    def testEmptyPhrase(self):
-        """ mail.sendmail: encode address with empty phrase: '<local@domain>' """
-        address = u'<local@domain>'
-        expected = address.encode(config.charset)
-        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
-                             expected)
-
-    def testEmptyAddress(self):
-        """ mail.sendmail: encode address with empty address: 'Phrase <>' 
-        
-        Let the smtp server handle this. We may raise error in such
-        case, but we don't do error checking for mail addresses.
-        """
-        address = u'Phrase <>'
-        phrase = str(Header(u'Phrase '.encode('utf-8'), self.charset))
-        expected = phrase + '<>'
-        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
-                             expected)
-
-    def testInvalidAddress(self):
-        """ mail.sendmail: encode invalid address 'Phrase <blah' 
-        
-        Assume that this is a simple address. This address will
-        probably cause an error when trying to send mail. Junk in, junk
-        out.
-        """
-        address = u'Phrase <blah'
-        expected = address.encode(config.charset)
-        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
-                             expected)
-
--- a/MoinMoin/_tests/test_request.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-    MoinMoin - MoinMoin.module_tested Tests
-
-    Module names must start with 'test_' to be included in the tests.
-
-    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>
-    @license: GNU GPL, see COPYING for details.
-"""
-
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
-from MoinMoin import config, wikiutil
-
-class TestNormalizePagename(unittest.TestCase):
-
-    def testPageInvalidChars(self):
-        """ request: normalize pagename: remove invalid unicode chars
-
-        Assume the default setting
-        """
-        test = u'\u0000\u202a\u202b\u202c\u202d\u202e'
-        expected = u''
-        result = self.request.normalizePagename(test)
-        self.assertEqual(result, expected,
-                         ('Expected "%(expected)s" but got "%(result)s"') % locals())
-
-    def testNormalizeSlashes(self):
-        """ request: normalize pagename: normalize slashes """
-        cases = (
-            (u'/////', u''),
-            (u'/a', u'a'),
-            (u'a/', u'a'),
-            (u'a/////b/////c', u'a/b/c'),
-            (u'a b/////c d/////e f', u'a b/c d/e f'),
-            )
-        for test, expected in cases:
-            result = self.request.normalizePagename(test)
-            self.assertEqual(result, expected,
-                             ('Expected "%(expected)s" but got "%(result)s"') %
-                             locals())
-
-    def testNormalizeWhitespace(self):
-        """ request: normalize pagename: normalize whitespace """
-        cases = (
-            (u'         ', u''),
-            (u'    a', u'a'),
-            (u'a    ', u'a'),
-            (u'a     b     c', u'a b c'),
-            (u'a   b  /  c    d  /  e   f', u'a b/c d/e f'),
-            # All 30 unicode spaces
-            (config.chars_spaces, u''),
-            )
-        for test, expected in cases:
-            result = self.request.normalizePagename(test)
-            self.assertEqual(result, expected,
-                             ('Expected "%(expected)s" but got "%(result)s"') %
-                             locals())
-
-    def testUnderscoreTestCase(self):
-        """ request: normalize pagename: underscore convert to spaces and normalized
-
-        Underscores should convert to spaces, then spaces should be
-        normalized, order is important!
-        """
-        cases = (
-            (u'         ', u''),
-            (u'  a', u'a'),
-            (u'a  ', u'a'),
-            (u'a  b  c', u'a b c'),
-            (u'a  b  /  c  d  /  e  f', u'a b/c d/e f'),
-            )
-        for test, expected in cases:
-            result = self.request.normalizePagename(test)
-            self.assertEqual(result, expected,
-                             ('Expected "%(expected)s" but got "%(result)s"') %
-                             locals())
-
-
-class TestGroupPages(unittest.TestCase):
-
-    def setUp(self):
-        self.config = self.TestConfig(page_group_regex=r'.+Group')
-
-    def tearDown(self):
-        del self.config
-
-    def testNormalizeGroupName(self):
-        """ request: normalize pagename: restrict groups to alpha numeric Unicode
-        
-        Spaces should normalize after invalid chars removed!
-        """
-        import re
-        cases = (
-            # current acl chars
-            (u'Name,:Group', u'NameGroup'),
-            # remove than normalize spaces
-            (u'Name ! @ # $ % ^ & * ( ) + Group', u'Name Group'),
-            )
-        for test, expected in cases:
-            # validate we are testing valid group names
-            if wikiutil.isGroupPage(self.request, test):
-                result = self.request.normalizePagename(test)
-                self.assertEqual(result, expected,
-                                 ('Expected "%(expected)s" but got "%(result)s"') %
-                                 locals())
-
-
-class TestHTTPDate(unittest.TestCase):
-
-    def testRFC1123Date(self):
-        """ request: httpDate default rfc1123 """
-        self.failUnlessEqual(self.request.httpDate(0),
-                             'Thu, 01 Jan 1970 00:00:00 GMT',
-                             'wrong date string')
-
-    def testRFC850Date(self):
-        """ request: httpDate rfc850 """
-        self.failUnlessEqual(self.request.httpDate(0, rfc='850'),
-                             'Thursday, 01-Jan-70 00:00:00 GMT',
-                             'wrong date string')
-
-
--- a/MoinMoin/_tests/test_search.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - MoinMoin.search Tests
-
-    @copyright: 2005 by Nir Soffer <nirs@freeshell.org>
-    @license: GNU GPL, see COPYING for details.
-"""
-
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
-from MoinMoin import search
-
-
-class TestQuotingBug(unittest.TestCase):
-    """search: quoting bug tests 
-    
-    http://moinmoin.wikiwikiweb.de/MoinMoinBugs/SearchOneCharString
-    
-    This is only a little stupid test for the isQuoted method, because
-    testing parsed queries is much more work.
-    """
-
-    def setUp(self):
-        self.parser = search.QueryParser()
-
-    def testIsQuoted(self):
-        """ search: quoting bug - quoted terms """
-        for case in ('"yes"', "'yes'"):
-            self.assertEqual(self.parser.isQuoted(case), True)
-
-    def testIsNot(self):
-        """ search: quoting bug - unquoted terms """
-        tests = ('', "'", '"', '""', "''", "'\"", '"no', 'no"', "'no",
-                 "no'", '"no\'')
-        for case in tests:
-            self.assertEqual(self.parser.isQuoted(case), False)
-
--- a/MoinMoin/_tests/test_security.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,277 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - MoinMoin.security Tests
-
-    TODO: when refactoring this, do not use "iter" (is a builtin)
-
-    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>
-                2007 by MoinMoin:ReimarBauer
-    @license: GNU GPL, see COPYING for details.
-"""
-
-import py
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
-from MoinMoin import security
-
-acliter = security.ACLStringIterator
-
-class TestACLStringIterator(unittest.TestCase):
-
-    def setUp(self):
-        self.config = self.TestConfig(defaults=['acl_rights_valid', 'acl_rights_before'])
-    def tearDown(self):
-        del self.config
-
-    def testEmpty(self):
-        """ security: empty acl string raise StopIteration """
-        iter = acliter(self.request.cfg.acl_rights_valid, '')
-        self.failUnlessRaises(StopIteration, iter.next)
-
-    def testWhiteSpace(self):
-        """ security: white space acl string raise StopIteration """
-        iter = acliter(self.request.cfg.acl_rights_valid, '       ')
-        self.failUnlessRaises(StopIteration, iter.next)
-
-    def testDefault(self):
-        """ security: default meta acl """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'Default Default')
-        for mod, entries, rights in iter:
-            self.assertEqual(entries, ['Default'])
-            self.assertEqual(rights, [])
-
-    def testEmptyRights(self):
-        """ security: empty rights """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'WikiName:')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['WikiName'])
-        self.assertEqual(rights, [])
-
-    def testSingleWikiNameSingleWrite(self):
-        """ security: single wiki name, single right """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'WikiName:read')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['WikiName'])
-        self.assertEqual(rights, ['read'])
-
-    def testMultipleWikiNameAndRights(self):
-        """ security: multiple wiki names and rights """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne,UserTwo:read,write')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['UserOne', 'UserTwo'])
-        self.assertEqual(rights, ['read', 'write'])
-
-    def testMultipleWikiNameAndRightsSpaces(self):
-        """ security: multiple names with spaces """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'user one,user two:read')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['user one', 'user two'])
-        self.assertEqual(rights, ['read'])
-
-    def testMultipleEntries(self):
-        """ security: multiple entries """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read,write UserTwo:read All:')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['UserOne'])
-        self.assertEqual(rights, ['read', 'write'])
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['UserTwo'])
-        self.assertEqual(rights, ['read'])
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['All'])
-        self.assertEqual(rights, [])
-
-    def testNameWithSpaces(self):
-        """ security: single name with spaces """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'user one:read')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['user one'])
-        self.assertEqual(rights, ['read'])
-
-    def testMultipleEntriesWithSpaces(self):
-        """ security: multiple entries with spaces """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'user one:read,write user two:read')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['user one'])
-        self.assertEqual(rights, ['read', 'write'])
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['user two'])
-        self.assertEqual(rights, ['read'])
-
-    def testMixedNames(self):
-        """ security: mixed wiki names and names with spaces """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne,user two:read,write user three,UserFour:read')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['UserOne', 'user two'])
-        self.assertEqual(rights, ['read', 'write'])
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['user three', 'UserFour'])
-        self.assertEqual(rights, ['read'])
-
-    def testModifier(self):
-        """ security: acl modifiers """
-        iter = acliter(self.request.cfg.acl_rights_valid, '+UserOne:read -UserTwo:')
-        mod, entries, rights = iter.next()
-        self.assertEqual(mod, '+')
-        self.assertEqual(entries, ['UserOne'])
-        self.assertEqual(rights, ['read'])
-        mod, entries, rights = iter.next()
-        self.assertEqual(mod, '-')
-        self.assertEqual(entries, ['UserTwo'])
-        self.assertEqual(rights, [])
-
-    def testIgnoreInvalidACL(self):
-        """ security: ignore invalid acl
-
-        The last part of this acl can not be parsed. If it ends with :
-        then it will be parsed as one name with spaces.
-        """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read user two is ignored')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['UserOne'])
-        self.assertEqual(rights, ['read'])
-        self.failUnlessRaises(StopIteration, iter.next)
-
-    def testEmptyNamesWithRight(self):
-        """ security: empty names with rights
-
-        The documents does not talk about this case, may() should ignore
-        the rights because there is no entry.
-        """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read :read All:')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['UserOne'])
-        self.assertEqual(rights, ['read'])
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, [])
-        self.assertEqual(rights, ['read'])
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['All'])
-        self.assertEqual(rights, [])
-
-    def testIgnodeInvalidRights(self):
-        """ security: ignore rights not in acl_rights_valid """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read,sing,write,drink,sleep')
-        mod, entries, rights = iter.next()
-        self.assertEqual(rights, ['read', 'write'])
-
-    def testBadGuy(self):
-        """ security: bad guy may not allowed anything
-
-        This test was failing on the apply acl rights test.
-        """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read,write BadGuy: All:read')
-        mod, entries, rights = iter.next()
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['BadGuy'])
-        self.assertEqual(rights, [])
-
-    def testAllowExtraWhitespace(self):
-        """ security: allow extra white space between entries """
-        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne,user two:read,write   user three,UserFour:read  All:')
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['UserOne', 'user two'])
-        self.assertEqual(rights, ['read', 'write'])
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['user three', 'UserFour'])
-        self.assertEqual(rights, ['read'])
-        mod, entries, rights = iter.next()
-        self.assertEqual(entries, ['All'])
-        self.assertEqual(rights, [])
-
-
-class TestAcl(unittest.TestCase):
-    """ security: testing access control list
-
-    TO DO: test unknown user?
-    """
-    def setUp(self):
-        # Backup user
-        self.config = self.TestConfig(defaults=['acl_rights_valid', 'acl_rights_before'])
-        self.savedUser = self.request.user.name
-
-    def tearDown(self):
-        # Restore user
-        self.request.user.name = self.savedUser
-        del self.config
-
-    def testApplyACLByUser(self):
-        """ security: applying acl by user name"""
-        # This acl string...
-        acl_rights = [
-            "Admin1,Admin2:read,write,delete,revert,admin  "
-            "Admin3:read,write,admin  "
-            "JoeDoe:read,write  "
-            "name with spaces,another one:read,write  "
-            "CamelCase,extended name:read,write  "
-            "BadGuy:  "
-            "All:read  "
-            ]
-        acl = security.AccessControlList(self.request.cfg, acl_rights)
-
-        # Should apply these rights:
-        users = (
-            # user,                 rights
-            # CamelCase names
-            ('Admin1',              ('read', 'write', 'admin', 'revert', 'delete')),
-            ('Admin2',              ('read', 'write', 'admin', 'revert', 'delete')),
-            ('Admin3',              ('read', 'write', 'admin')),
-            ('JoeDoe',              ('read', 'write')),
-            ('SomeGuy',             ('read',)),
-            # Extended names or mix of extended and CamelCase
-            ('name with spaces',    ('read','write',)),
-            ('another one',         ('read','write',)),
-            ('CamelCase',           ('read','write',)),
-            ('extended name',       ('read','write',)),
-            # Blocking bad guys
-            ('BadGuy',              ()),
-            # All other users - every one not mentioned in the acl lines
-            ('All',                 ('read',)),
-            ('Anonymous',           ('read',)),
-            )
-
-        # Check rights
-        for user, may in users:
-            mayNot = [right for right in self.request.cfg.acl_rights_valid
-                      if right not in may]
-            # User should have these rights...
-            for right in may:
-                self.assert_(acl.may(self.request, user, right),
-                    '"%(user)s" should be allowed to "%(right)s"' % locals())
-            # But NOT these:
-            for right in mayNot:
-                self.failIf(acl.may(self.request, user, right),
-                    '"%(user)s" should NOT be allowed to "%(right)s"' % locals())
-
-    def testACLsWithoutEditLogEntry(self):
-        """ tests what are the page rights if edit-log entry doesn't exist
-            for a page where no access is given to
-        """
-        py.test.skip("test tricks out the caching system, page modifications without making an edit-log entry are not supported")
-        import os
-        from MoinMoin.Page import Page
-        pagename = u'AutoCreatedMoinMoinTemporaryTestPage'
-
-        result = self.request.user.may.write(pagename)
-        page = Page(self.request, pagename)
-        path = page.getPagePath(use_underlay=0, check_create=0)
-        if os.path.exists(path):
-            py.test.skip("%s exists. Won't overwrite exiting page" % self.dictPage)
-
-        try:
-            try:
-                os.mkdir(path)
-                revisionsDir = os.path.join(path, 'revisions')
-                os.mkdir(revisionsDir)
-                current = '00000001'
-                file(os.path.join(path, 'current'), 'w').write('%s\n' % current)
-                text = u'#acl All: \n'
-                file(os.path.join(revisionsDir, current), 'w').write(text)
-            except Exception, err:
-                py.test.skip("Can not be create test page: %s" % err)
-    
-            assert not self.request.user.may.write(pagename)
-        finally:
-            if os.path.exists(path):
-                import shutil
-                shutil.rmtree(path, True)
-
--- a/MoinMoin/_tests/test_widget_html.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - MoinMoin.widget.html Tests
-
-    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>
-    @license: GNU GPL, see COPYING for details.
-"""
-
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
-from MoinMoin.widget import html
-
-class TestHTMLWidgets(unittest.TestCase):
-    """widget.html: testing html widgets"""
-
-    def testCreate(self):
-        """widget.html: creating html widgets
-
-        TO DO: add tests for all elements by HTML 4 spec.
-        """
-        tests = (
-            # description, call, expected           
-            ('Create text', html.Text('<br> &'), '&lt;br&gt; &amp;'),
-            ('Create raw html', html.Raw('<br> &amp;'), '<br> &amp;'),
-            ('Create br', html.BR(), '<br>'),
-            ('Create hr', html.HR(), '<hr>'),
-            ('Create p', html.P(), '<p></p>'),
-            )
-
-        for description, obj, expected in tests:
-            result = unicode(obj)
-            self.assertEqual(result, expected,
-                             ('%(description)s: expected "%(expected)s" '
-                              'but got "%(result)s"') % locals())
-
-    def testInvalidAttributes(self):
-        """widegt.html: invalid attributes raises exception
-
-        TO DO: add tests for all elements by HTML 4 spec.
-        """
-        self.assertRaises(AttributeError, html.BR, name='foo')
-
-
-    def testCompositeElements(self):
-        """widget.html: append to and extend composite element"""
-        html._SORT_ATTRS = 1
-        element = html.P()
-
-        actions = (
-            # action, data, expected
-            (element.append,
-             html.Text('Text & '),
-             '<p>Text &amp; </p>'),
-            (element.append,
-             html.Text('more text. '),
-             '<p>Text &amp; more text. </p>'),
-            (element.extend,
-             (html.Text('And then '), html.Text('some.')),
-             '<p>Text &amp; more text. And then some.</p>'),
-            )
-
-        for action, data, expected in actions:
-            action(data)
-            result = unicode(element)
-            self.assertEqual(result, expected,
-                             'Expected "%(expected)s" but got "%(result)s"' % locals())
-
--- a/MoinMoin/_tests/test_wikixml_marshal.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - MoinMoin.wikixml.marshal Tests
-
-    @copyright: 2002-2004 by Juergen Hermann <jh@web.de>
-    @license: GNU GPL, see COPYING for details.
-"""
-
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
-import array
-from MoinMoin.wikixml import marshal
-
-class TestMarshal(unittest.TestCase):
-    """Testing Marshal used for ...XXX"""
-
-    class Data:
-        cvar = 'Class Variable'
-        def __init__(self, value):
-            self.ivar = value
-
-    prop = (
-        # value, xml representation in a marshal object
-        (None, '<data><prop><none/></prop></data>'),
-        ("string", '<data><prop>string</prop></data>'),
-        ([1, "abc"], '<data><prop><item>1</item><item>abc</item></prop></data>'),
-        ((1, "abc"), '<data><prop><item>1</item><item>abc</item></prop></data>'),
-        ({"abc": 1}, '<data><prop><abc>1</abc></prop></data>'),
-        (1, '<data><prop>1</prop></data>'),
-        (Data('value'), '<data><prop><data><ivar>value</ivar></data></prop></data>'),
-        (array.array("i", [42]), "<data><prop>array('i', [42])</prop></data>"),
-        (buffer("0123456789", 2, 3), "<data><prop>234</prop></data>"),
-        )
-
-    def setUp(self):
-        self.obj = marshal.Marshal()
-
-    def testCreateMarshal(self):
-        """wikixml.marshal: create new marshal"""
-        self._checkData(self.obj, '<data></data>')
-
-    def testSetMarshalProperty(self):
-        """wikixml.marshal: setting marshal property"""
-        for value, xml in self.prop:
-            self.obj.prop = value
-            self._checkData(self.obj, xml)
-
-    def _canonize(self, xml):
-        xml = xml.replace('\n', '')
-        return xml
-
-    def _checkData(self, obj, xml):
-        objXML = self._canonize(obj.toXML())
-        expected = self._canonize(xml)
-        self.assertEqual(objXML, expected,
-            'Expected "%(expected)s" but got "%(objXML)s"' % locals())
-
--- a/MoinMoin/_tests/test_xmlrpc_multicall.py	Sun Jul 01 02:26:02 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - MoinMoin.xmlrpc.xmlrpc_system_multicall Fault serialization
-
-    @copyright: 2007 by Karol Nowak <grywacz@gmail.com>
-    @license: GNU GPL, see COPYING for details.
-"""
-
-from MoinMoin.xmlrpc import XmlRpcBase
-from MoinMoin.request.CLI import Request
-from xmlrpclib import Fault
-
-def xmlrpc_return_fault():
-    return Fault(666, "Fault description")
-
-def test_fault_serialization():
-    xmlrpc = XmlRpcBase(Request())
-    xmlrpc.xmlrpc_return_fault = xmlrpc_return_fault
-    args = [{'methodName': 'return_fault', 'params': [ ]}]
-    
-    print """If a XML RPC method returns a Fault, we should get a failure response
-    instead of a serialized Fault, as it happened in the past. See revision
-    8b7d6d70fc95 for details"""
-    
-    result = xmlrpc.xmlrpc_system_multicall(args)
-    assert(type(result[0]) == dict)
-    assert(result[0].has_key("faultCode") and result[0].has_key("faultString"))
-    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/converter/_tests/test_text_html_text_moin_wiki.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,1136 @@
+# -*- coding: utf-8 -*-
+"""
+MoinMoin - MoinMoin.text_html_text_moin_wiki Tests
+
+@copyright: 2005 by Bastian Blank, ThomasWaldmann
+@license: GNU GPL, see COPYING for details.
+"""
+
+import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+
+import py
+py.test.skip("Many broken tests, much broken code, broken, broken, broken.")
+
+from cStringIO import StringIO
+from MoinMoin.converter import text_html_text_moin_wiki as converter
+from MoinMoin.parser.text_moin_wiki import Parser
+from MoinMoin.formatter.text_gedit import Formatter
+from MoinMoin.request import Clock
+from MoinMoin.error import ConvertError
+
+convert = converter.convert
+error = ConvertError
+
+
+class TestBase(unittest.TestCase):
+
+    def setUp(self):
+        self.cfg = self.TestConfig(bang_meta=True)
+        
+    def tearDown(self):
+        del self.cfg
+
+    def do_convert_real(self, func_args, successful=True):
+        try:
+            ret = convert(*func_args)
+        except error, e:
+            if successful:
+                self.fail("fails with parse error: %s" % e)
+            else:
+                return
+        if successful:
+            return ret
+        else:
+            self.fail("doesn't fail with parse error")
+
+
+class MinimalPage(object):
+    def __init__(self):
+        self.hilite_re = None
+        self.page_name = "testpage"
+
+
+class MinimalRequest(object):
+    # TODO: do we really need this class? no other test uses a request replacement.
+
+    def __init__(self, request):
+        self.request = request
+        self.clock = Clock()
+        
+        # This is broken - tests that need correct content_lang will fail
+        self.content_lang = None
+        self.current_lang = None
+        
+        self.form = {}
+        self._page_headings = {}
+        self.result = []
+
+    def getText(self, text, formatted=True):
+        return text
+
+    def write(self, text):
+        self.result.append(text)
+
+    def __getattr__(self, name):
+        return getattr(self.request, name)
+
+
+class TestConvertBlockRepeatable(TestBase):
+    def do(self, text, output):
+        text = text.lstrip('\n')
+        output = output.strip('\n')
+        request = MinimalRequest(self.request)
+        page = MinimalPage()
+        formatter = Formatter(request)
+        formatter.setPage(page)
+        Parser(text, request).format(formatter)
+        repeat = ''.join(request.result).strip('\n')
+        self.failUnlessEqual(repeat, output)
+        out = self.do_convert_real([request, page.page_name, repeat])
+        self.failUnlessEqual(text, out)
+
+    def testComment01(self):
+        test = ur"""
+##test
+"""
+        output = u"""<pre class="comment">\n##test</pre>"""
+        self.do(test, output)
+
+    def testComment02(self):
+        test = ur"""
+##test
+##test
+"""
+        output = u"""
+<pre class="comment">\n##test</pre>
+<pre class="comment">\n##test</pre>
+"""
+        self.do(test, output)
+
+    def testHeading01(self):
+        test = ur"""
+= test1 =
+
+"""
+        output = ur"""
+<h2>test1</h2>
+"""
+        self.do(test, output)
+
+    def testHeading02(self):
+        test = ur"""
+= test1 =
+
+== test2 ==
+
+"""
+        output = ur"""
+<h2>test1</h2>
+<h3>test2</h3>
+"""
+        self.do(test, output)
+
+    def testListSuccess01(self):
+        test = ur"""
+ * test
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testListSuccess02(self):
+        test = ur"""
+ 1. test
+
+"""
+        output = ur"""
+<ol type="1">
+<li><p>test </p>
+</li>
+</ol>
+"""
+        self.do(test, output)
+
+    def testListSuccess03(self):
+        test = ur"""
+ test:: test
+
+"""
+        output = ur"""
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+"""
+        self.do(test, output)
+
+    def testListSuccess04(self):
+        test = ur"""
+ * test
+ * test
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+</li>
+<li><p>test </p>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testListSuccess05(self):
+        test = ur"""
+ 1. test
+ 1. test
+
+"""
+        output = ur"""
+<ol type="1">
+<li><p>test </p>
+</li>
+<li><p>test </p>
+</li>
+</ol>
+"""
+        self.do(test, output)
+
+    def testListSuccess06(self):
+        test = ur"""
+ test:: test
+ test:: test
+
+"""
+        output = ur"""
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+"""
+        self.do(test, output)
+
+    def testListSuccess07(self):
+        test = ur"""
+ * test
+  
+ * test
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testListSuccess08(self):
+        test = ur"""
+ 1. test
+  
+ 1. test
+
+"""
+        output = ur"""
+<ol type="1">
+<li><p>test </p>
+</li>
+</ol>
+<ol type="1">
+<li><p>test </p>
+</li>
+</ol>
+"""
+        self.do(test, output)
+
+    def testListSuccess09(self):
+        test = ur"""
+ test:: test
+  
+ test:: test
+
+"""
+        output = ur"""
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+"""
+        self.do(test, output)
+
+    def testListSuccess10(self):
+        test = ur"""
+ * test
+  * test
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testListSuccess11(self):
+        test = ur"""
+ 1. test
+  1. test
+
+"""
+        output = ur"""
+<ol type="1">
+<li><p>test </p>
+<ol type="1">
+<li><p>test </p>
+</li>
+</ol>
+</li>
+</ol>
+"""
+        self.do(test, output)
+
+    def testListSuccess12(self):
+        test = ur"""
+ test:: test
+  test:: test
+
+"""
+        output = ur"""
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+</dd>
+</dl>
+"""
+        self.do(test, output)
+
+    def testListSuccess13(self):
+        test = ur"""
+ * test
+  * test
+ * test
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+</li>
+<li><p>test </p>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testListSuccess14(self):
+        test = ur"""
+ 1. test
+  1. test
+ 1. test
+
+"""
+        output = ur"""
+<ol type="1">
+<li><p>test </p>
+<ol type="1">
+<li><p>test </p>
+</li>
+</ol>
+</li>
+<li><p>test </p>
+</li>
+</ol>
+"""
+        self.do(test, output)
+
+    def testListSuccess15(self):
+        test = ur"""
+ test:: test
+  test:: test
+ test:: test
+
+"""
+        output = ur"""
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+</dd>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+"""
+        self.do(test, output)
+
+    def testListSuccess16(self):
+        test = ur"""
+ * test
+
+ 1. test
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+<ol type="1">
+<li><p>test </p>
+</li>
+</ol>
+"""
+        self.do(test, output)
+
+    def testListSuccess17(self):
+        test = ur"""
+ * test
+
+ test:: test
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+"""
+        self.do(test, output)
+
+    def testListSuccess18(self):
+        test = ur"""
+ 1. test
+
+ * test
+
+"""
+        output = ur"""
+<ol type="1">
+<li><p>test </p>
+</li>
+</ol>
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testListSuccess19(self):
+        test = ur"""
+ 1. test
+
+ test:: test
+
+"""
+        output = ur"""
+<ol type="1">
+<li><p>test </p>
+</li>
+</ol>
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+"""
+        self.do(test, output)
+
+    def testListSuccess20(self):
+        test = ur"""
+ test:: test
+
+ * test
+
+"""
+        output = ur"""
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testListSuccess21(self):
+        test = ur"""
+ test:: test
+
+ 1. test
+
+"""
+        output = ur"""
+<dl>
+<dt>test</dt>
+<dd><p>test </p>
+</dd>
+</dl>
+<ol type="1">
+<li><p>test </p>
+</li>
+</ol>
+"""
+        self.do(test, output)
+
+    def testListSuccess23(self):
+        test = ur"""
+ 1. test
+  * test
+
+"""
+        output = ur"""
+<ol type="1">
+<li><p>test </p>
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+</li>
+</ol>
+"""
+        self.do(test, output)
+
+    def testListSuccess26(self):
+        test = ur"""
+ * test
+
+test
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+<p>test </p>
+"""
+        self.do(test, output)
+
+    def testListSuccess28(self):
+        test = ur"""
+ * test
+
+ test
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+<p>test </p>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testListSuccess29(self):
+        test = ur"""
+ * test
+  * test
+ test
+"""
+        output = ur"""
+"""
+        self.do(test, output)
+
+    def testListSuccess30(self):
+        test = ur"""
+ * test
+  * test
+  test
+"""
+        output = ur"""
+"""
+        self.do(test, output)
+
+    def testParagraph1(self):
+        test = ur"""
+test
+
+"""
+        output = ur"""
+<p>test </p>
+"""
+        self.do(test, output)
+
+    def testParagraph2(self):
+        test = ur"""
+test
+
+test
+
+"""
+        output = ur"""
+<p>test </p>
+<p>test </p>
+"""
+        self.do(test, output)
+
+    def testPreSuccess1(self):
+        test = ur"""
+{{{
+test
+}}}
+
+"""
+        output = ur"""
+<pre>
+test
+</pre>
+"""
+        self.do(test, output)
+
+    def testPreSuccess2(self):
+        test = ur"""
+{{{
+test
+test
+}}}
+
+"""
+        output = ur"""
+<pre>
+test
+test
+</pre>
+"""
+        self.do(test, output)
+
+    def testPreSuccess3(self):
+        test = ur"""
+{{{
+test
+
+test
+}}}
+
+"""
+        output = ur"""
+<pre>
+test
+
+test
+</pre>
+"""
+        self.do(test, output)
+
+    def testPreSuccess4(self):
+        test = ur"""
+{{{
+ * test
+}}}
+
+"""
+        output = ur"""
+<pre>
+ * test
+</pre>
+"""
+        self.do(test, output)
+
+    def testPreSuccess5(self):
+        test = ur"""
+{{{
+  }}}
+
+"""
+        output = ur"""
+<pre>
+  </pre>
+"""
+        self.do(test, output)
+
+    def testPreSuccess6(self):
+        test = ur"""
+ * {{{
+test
+}}}
+
+"""
+        output = ur"""
+<ul>
+<li>
+<pre>
+test
+</pre>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testPreSuccess7(self):
+        test = ur"""
+ * {{{
+   test
+   }}}
+
+"""
+        output = ur"""
+<ul>
+<li>
+<pre>
+   test
+   </pre>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testPreSuccess8(self):
+        test = ur"""
+ * test
+ {{{
+test
+}}}
+
+"""
+        output = ur"""
+<ul>
+<li><p>test 
+</p>
+<pre>
+test
+</pre>
+</li>
+</ul>
+"""
+        self.do(test, output)
+
+    def testPreSuccess9(self):
+        test = ur"""
+ * test
+
+{{{
+test
+}}}
+
+"""
+        output = ur"""
+<ul>
+<li><p>test </p>
+</li>
+</ul>
+
+<pre>
+test
+</pre>
+"""
+        self.do(test, output)
+
+    def testRule1(self):
+        test = ur"""
+----
+
+"""
+        output = ur"""
+<hr/>
+"""
+        self.do(test, output)
+
+    def testTable01(self):
+        test = ur"""
+|| ||
+
+"""
+        output = ur"""
+<div>
+<table>
+<tr>
+<td>
+<p> </p>
+</td>
+</tr>
+</table>
+</div>
+"""
+        self.do(test, output)
+
+    def testTable02(self):
+        test = ur"""
+||test||
+
+"""
+        output = ur"""
+<div>
+<table>
+<tr>
+<td>
+<p>test</p>
+</td>
+</tr>
+</table>
+</div>
+"""
+        self.do(test, output)
+
+    def testTable03(self):
+        test = ur"""
+||test||test||
+
+"""
+        output = ur"""
+<div>
+<table>
+<tr>
+<td>
+<p>test</p>
+</td>
+<td>
+<p>test</p>
+</td>
+</tr>
+</table>
+</div>
+"""
+        self.do(test, output)
+
+    def testTable04(self):
+        test = ur"""
+||test||
+||test||test||
+
+"""
+        output = ur"""
+<div>
+<table>
+<tr>
+<td>
+<p>test</p>
+</td>
+</tr>
+<tr>
+<td>
+<p>test</p>
+</td>
+<td>
+<p>test</p>
+</td>
+</tr>
+</table>
+</div>
+"""
+        self.do(test, output)
+
+    def testTable05(self):
+        test = ur"""
+||||test||
+||test||test||
+
+"""
+        output = ur"""
+<div>
+<table>
+<tr>
+<td colspan="2" style="text-align: center;">
+<p>test</p>
+</td>
+</tr>
+<tr>
+<td>
+<p>test</p>
+</td>
+<td>
+<p>test</p>
+</td>
+</tr>
+</table>
+</div>
+"""
+        self.do(test, output)
+
+    def testTable06(self):
+        test = ur"""
+||||test||test||
+||test||||test||
+
+"""
+        output = ur"""
+<div>
+<table>
+<tr>
+<td colspan="2" style="text-align: center;">
+<p>test</p>
+</td>
+<td>
+<p>test</p>
+</td>
+</tr>
+<tr>
+<td>
+<p>test</p>
+</td>
+<td colspan="2" style="text-align: center;">
+<p>test</p>
+</td>
+</tr>
+</table>
+</div>
+"""
+        self.do(test, output)
+
+class TestConvertInlineFormatRepeatable(TestBase):
+    def do(self, text, output):
+        text = text.lstrip('\n')
+        output = output.strip('\n')
+        output = "<p>%s </p>" % output
+        request = MinimalRequest(self.request)
+        page = MinimalPage()
+        formatter = Formatter(request)
+        formatter.setPage(page)
+        Parser(text, request).format(formatter)
+        repeat = ''.join(request.result).strip('\n')
+        self.failUnlessEqual(repeat, output)
+        out = self.do_convert_real([request, page.page_name, repeat])
+        out = out.rstrip('\n')
+        self.failUnlessEqual(text, out)
+
+    def testEmphasis01(self):
+        test = ur"''test''"
+        output = ur"<em>test</em>"
+        self.do(test, output)
+
+    def testEmphasis02(self):
+        test = ur"'''test'''"
+        output = ur"<strong>test</strong>"
+        self.do(test, output)
+
+    def testEmphasis03(self):
+        test = ur"'''''test'''''"
+        output = ur"<em><strong>test</strong></em>"
+        self.do(test, output)
+
+    def testEmphasis04(self):
+        test = ur"''test'''test'''''"
+        output = ur"<em>test<strong>test</strong></em>"
+        self.do(test, output)
+
+    def testEmphasis05(self):
+        test = ur"'''test''test'''''"
+        output = ur"<strong>test<em>test</em></strong>"
+        self.do(test, output)
+
+    def testEmphasis06(self):
+        test = ur"''test'''test'''test''"
+        output = ur"<em>test<strong>test</strong>test</em>"
+        self.do(test, output)
+
+    def testEmphasis07(self):
+        test = ur"'''test''test''test'''"
+        output = ur"<strong>test<em>test</em>test</strong>"
+        self.do(test, output)
+
+    def testEmphasis08(self):
+        test = ur"''test'''''test'''"
+        output = ur"<em>test</em><strong>test</strong>"
+        self.do(test, output)
+
+    def testEmphasis09(self):
+        test = ur"'''test'''''test''"
+        output = ur"<strong>test</strong><em>test</em>"
+        self.do(test, output)
+
+    def testEmphasis10(self):
+        test = ur"'''''test''test'''"
+        output = ur"<strong><em>test</em>test</strong>"
+        self.do(test, output)
+
+    def testEmphasis11(self):
+        test = ur"'''''test'''test''"
+        output = ur"<em><strong>test</strong>test</em>"
+        self.do(test, output)
+
+    def testFormatBig01(self):
+        test = ur"~+test+~"
+        output = ur"<big>test</big>"
+        self.do(test, output)
+
+    def testFormatSmall01(self):
+        test = ur"~-test-~"
+        output = ur"<small>test</small>"
+        self.do(test, output)
+
+    def testFormatStrike01(self):
+        test = ur"--(test)--"
+        output = ur"<strike>test</strike>"
+        self.do(test, output)
+
+    def testFormatSub01(self):
+        test = ur",,test,,"
+        output = ur"<sub>test</sub>"
+        self.do(test, output)
+
+    def testFormatSup01(self):
+        test = ur"^test^"
+        output = ur"<sup>test</sup>"
+        self.do(test, output)
+
+    def testFormatUnderline01(self):
+        test = ur"__test__"
+        output = ur"<u>test</u>"
+        self.do(test, output)
+
+    def testPre01(self):
+        test = ur"{{{test}}}"
+        output = ur"<tt>test</tt>"
+        self.do(test, output)
+
+    def testWhitespace01(self):
+        test = ur"''test '''test'''''"
+        output = ur"<em>test <strong>test</strong></em>"
+        self.do(test, output)
+
+class TestConvertInlineItemRepeatable(TestBase):
+    def do(self, text, output):
+        text = text.lstrip('\n')
+        output = output.strip('\n')
+        output = "<p>%s </p>" % output
+        request = MinimalRequest(self.request)
+        page = MinimalPage()
+        formatter = Formatter(request)
+        formatter.setPage(page)
+        Parser(text, request).format(formatter)
+        repeat = ''.join(request.result).strip('\n')
+        self.failUnlessEqual(repeat, output)
+        out = self.do_convert_real([request, page.page_name, repeat])
+        out = out.rstrip('\n')
+        self.failUnlessEqual(text, out)
+
+    def testWikiWord01(self):
+        test = ur"WikiWord"
+        output = ur"""<a class="nonexistent" href="./WikiWord">WikiWord</a>"""
+        self.do(test, output)
+
+    def testNoWikiWord01(self):
+        test = ur"!WikiWord"
+        output = ur"WikiWord"
+        self.do(test, output)
+
+    def testSmiley01(self):
+        test = ur":-)"
+        output = ur"""<img src="/wiki/modern/img/smile.png" alt=":-)" height="15" width="15">"""
+        self.do(test, output)
+
+class TestStrip(unittest.TestCase):
+    def do(self, cls, text, output):
+        tree = converter.parse(text)
+        cls().do(tree)
+        out = StringIO()
+        try:
+            import xml.dom.ext
+        except ImportError:
+            py.test.skip('xml.dom.ext module is not available')
+        xml.dom.ext.Print(tree, out)
+        self.failUnlessEqual("<?xml version='1.0' encoding='UTF-8'?>%s" % output, out.getvalue().decode("utf-8"))
+
+class TestStripWhitespace(TestStrip):
+    def do(self, text, output):
+        super(TestStripWhitespace, self).do(converter.strip_whitespace, text, output)
+
+    def test1(self):
+        test = ur"""
+<t/>
+"""
+        output = ur"""<t/>"""
+        self.do(test, output)
+
+    def test2(self):
+        test = ur"""
+<t>
+  <z/>
+</t>
+"""
+        output = ur"""<t><z/></t>"""
+        self.do(test, output)
+
+    def test3(self):
+        test = ur"""
+<t>
+  <z>test</z>
+</t>
+"""
+        output = ur"""<t><z>test</z></t>"""
+        self.do(test, output)
+
+    def test4(self):
+        test = ur"""<p>&nbsp;</p>"""
+        output = ur""""""
+        self.do(test, output)
+
+    def test5(self):
+        test = ur"""<p>test </p>"""
+        output = ur"""<p>test</p>"""
+        self.do(test, output)
+
+class TestConvertBrokenBrowser(TestBase):
+    def do(self, text, output):
+        text = text.strip('\n')
+        output = output.lstrip('\n')
+        request = MinimalRequest(self.request)
+        page = MinimalPage()
+        out = self.do_convert_real([request, page.page_name, text])
+        self.failUnlessEqual(output, out)
+
+    def testList01(self):
+        test = ur"""
+<ul>
+<li>test</li>
+<ul>
+<li>test</li>
+</ul>
+<li>test</li>
+</ul>
+"""
+        output = ur"""
+ * test
+  * test
+ * test
+
+"""
+        self.do(test, output)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/formatter/_tests/test_formatter.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,78 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - MoinMoin.formatter.* Tests
+
+    @copyright: 2005 by MoinMoin:AlexanderSchremmer
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import py
+
+import re
+
+from MoinMoin.Page import Page
+from MoinMoin import wikiutil
+
+
+class TestFormatter:
+    def testSyntaxReferenceDomXml(self):
+        py.test.skip("dom_xml formatter is known to be broken")
+        f_name = 'dom_xml'
+        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 testSyntaxReferenceDocBook(self):
+        py.test.skip("breaks with an attribute error, it should be checked whether the formatter on the DB branch is broken as well")
+        try:
+            from xml.dom import getDOMImplementation
+            dom = getDOMImplementation("4DOM")
+        except ImportError:
+            # if we don't have 4suite installed, the docbook formatter would just raise an exception
+            py.test.skip("not testing docbook formatter because no 4suite installed")
+        else:
+            f_name = 'text_docbook'
+            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 testSyntaxReferenceOthers(self):
+        formatters = wikiutil.getPlugins("formatter", self.request.cfg)
+
+        # we have separate tests for those:
+        formatters.remove('text_docbook')
+        formatters.remove('dom_xml')
+
+        for f_name in formatters:
+            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, content_only=1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/macro/_tests/test_macro.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,34 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - MoinMoin.macro Tests
+
+    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>,
+                2006 MoinMoin:ThomasWaldmann
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+
+from MoinMoin import macro
+from MoinMoin.parser.text import Parser
+from MoinMoin.formatter.text_html import Formatter
+
+
+class TestMacro(unittest.TestCase):
+    def testTrivialMacro(self):
+        """macro: trivial macro works"""
+        m = self._make_macro()
+        expected = m.formatter.linebreak(0)
+        result = m.execute("BR", "")
+        self.assertEqual(result, expected,
+            'Expected "%(expected)s" but got "%(result)s"' % locals())
+
+    def _make_macro(self):
+        """Test helper"""
+        p = Parser("##\n", self.request)
+        p.formatter = Formatter(self.request)
+        self.request.formatter = p.formatter
+        p.form = self.request.form
+        m = macro.Macro(p)
+        return m
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/mail/_tests/test_sendmail.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,115 @@
+# -*- coding: utf-8 -*-
+"""
+    MoinMoin - MoinMoin.mail.sendmail Tests
+
+    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+from email.Charset import Charset, QP
+from email.Header import Header
+from MoinMoin.mail import sendmail
+from MoinMoin import config
+
+
+class TestdecodeSpamSafeEmail(unittest.TestCase):
+    """mail.sendmail: testing mail"""
+
+    _tests = (
+        ('', ''),
+        ('AT', '@'),
+        ('DOT', '.'),
+        ('DASH', '-'),
+        ('CAPS', ''),
+        ('Mixed', 'Mixed'),
+        ('lower', 'lower'),
+        ('Firstname DOT Lastname AT example DOT net',
+         'Firstname.Lastname@example.net'),
+        ('Firstname . Lastname AT exa mp le DOT n e t',
+         'Firstname.Lastname@example.net'),
+        ('Firstname I DONT WANT SPAM . Lastname@example DOT net',
+         'Firstname.Lastname@example.net'),
+        ('First name I Lastname DONT AT WANT SPAM example DOT n e t',
+         'FirstnameLastname@example.net'),
+        ('first.last@example.com', 'first.last@example.com'),
+        ('first . last @ example . com', 'first.last@example.com'),
+        )
+
+    def testDecodeSpamSafeMail(self):
+        """mail.sendmail: decoding spam safe mail"""
+        for coded, expected in self._tests:
+            result = sendmail.decodeSpamSafeEmail(coded)
+            self.assertEqual(result, expected,
+                             'Expected "%(expected)s" but got "%(result)s"' %
+                             locals())
+
+
+class TestEncodeAddress(unittest.TestCase):
+    """ Address encoding tests
+    
+    See http://www.faqs.org/rfcs/rfc2822.html section 3.4. 
+    Address Specification.
+            
+    mailbox     =   name-addr / addr-spec
+    name-addr   =   [display-name] angle-addr
+    angle-addr  =   [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
+    """
+    charset = Charset(config.charset)
+    charset.header_encoding = QP
+    charset.body_encoding = QP
+
+    def testSimpleAddress(self):
+        """ mail.sendmail: encode simple address: local@domain """
+        address = u'local@domain'
+        expected = address.encode(config.charset)
+        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
+                             expected)
+
+    def testComposite(self):
+        """ mail.sendmail: encode address: 'Phrase <local@domain>' """
+        address = u'Phrase <local@domain>'
+        phrase = str(Header(u'Phrase '.encode('utf-8'), self.charset))
+        expected = phrase + '<local@domain>'
+        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
+                             expected)
+
+    def testCompositeUnicode(self):
+        """ mail.sendmail: encode Uncode address: 'ויקי <local@domain>' """
+        address = u'ויקי <local@domain>'
+        phrase = str(Header(u'ויקי '.encode('utf-8'), self.charset))
+        expected = phrase + '<local@domain>'
+        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
+                             expected)
+
+    def testEmptyPhrase(self):
+        """ mail.sendmail: encode address with empty phrase: '<local@domain>' """
+        address = u'<local@domain>'
+        expected = address.encode(config.charset)
+        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
+                             expected)
+
+    def testEmptyAddress(self):
+        """ mail.sendmail: encode address with empty address: 'Phrase <>' 
+        
+        Let the smtp server handle this. We may raise error in such
+        case, but we don't do error checking for mail addresses.
+        """
+        address = u'Phrase <>'
+        phrase = str(Header(u'Phrase '.encode('utf-8'), self.charset))
+        expected = phrase + '<>'
+        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
+                             expected)
+
+    def testInvalidAddress(self):
+        """ mail.sendmail: encode invalid address 'Phrase <blah' 
+        
+        Assume that this is a simple address. This address will
+        probably cause an error when trying to send mail. Junk in, junk
+        out.
+        """
+        address = u'Phrase <blah'
+        expected = address.encode(config.charset)
+        self.failUnlessEqual(sendmail.encodeAddress(address, self.charset),
+                             expected)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/request/_tests/test_request.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,122 @@
+# -*- coding: utf-8 -*-
+"""
+    MoinMoin - MoinMoin.module_tested Tests
+
+    Module names must start with 'test_' to be included in the tests.
+
+    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+from MoinMoin import config, wikiutil
+
+class TestNormalizePagename(unittest.TestCase):
+
+    def testPageInvalidChars(self):
+        """ request: normalize pagename: remove invalid unicode chars
+
+        Assume the default setting
+        """
+        test = u'\u0000\u202a\u202b\u202c\u202d\u202e'
+        expected = u''
+        result = self.request.normalizePagename(test)
+        self.assertEqual(result, expected,
+                         ('Expected "%(expected)s" but got "%(result)s"') % locals())
+
+    def testNormalizeSlashes(self):
+        """ request: normalize pagename: normalize slashes """
+        cases = (
+            (u'/////', u''),
+            (u'/a', u'a'),
+            (u'a/', u'a'),
+            (u'a/////b/////c', u'a/b/c'),
+            (u'a b/////c d/////e f', u'a b/c d/e f'),
+            )
+        for test, expected in cases:
+            result = self.request.normalizePagename(test)
+            self.assertEqual(result, expected,
+                             ('Expected "%(expected)s" but got "%(result)s"') %
+                             locals())
+
+    def testNormalizeWhitespace(self):
+        """ request: normalize pagename: normalize whitespace """
+        cases = (
+            (u'         ', u''),
+            (u'    a', u'a'),
+            (u'a    ', u'a'),
+            (u'a     b     c', u'a b c'),
+            (u'a   b  /  c    d  /  e   f', u'a b/c d/e f'),
+            # All 30 unicode spaces
+            (config.chars_spaces, u''),
+            )
+        for test, expected in cases:
+            result = self.request.normalizePagename(test)
+            self.assertEqual(result, expected,
+                             ('Expected "%(expected)s" but got "%(result)s"') %
+                             locals())
+
+    def testUnderscoreTestCase(self):
+        """ request: normalize pagename: underscore convert to spaces and normalized
+
+        Underscores should convert to spaces, then spaces should be
+        normalized, order is important!
+        """
+        cases = (
+            (u'         ', u''),
+            (u'  a', u'a'),
+            (u'a  ', u'a'),
+            (u'a  b  c', u'a b c'),
+            (u'a  b  /  c  d  /  e  f', u'a b/c d/e f'),
+            )
+        for test, expected in cases:
+            result = self.request.normalizePagename(test)
+            self.assertEqual(result, expected,
+                             ('Expected "%(expected)s" but got "%(result)s"') %
+                             locals())
+
+
+class TestGroupPages(unittest.TestCase):
+
+    def setUp(self):
+        self.config = self.TestConfig(page_group_regex=r'.+Group')
+
+    def tearDown(self):
+        del self.config
+
+    def testNormalizeGroupName(self):
+        """ request: normalize pagename: restrict groups to alpha numeric Unicode
+        
+        Spaces should normalize after invalid chars removed!
+        """
+        import re
+        cases = (
+            # current acl chars
+            (u'Name,:Group', u'NameGroup'),
+            # remove than normalize spaces
+            (u'Name ! @ # $ % ^ & * ( ) + Group', u'Name Group'),
+            )
+        for test, expected in cases:
+            # validate we are testing valid group names
+            if wikiutil.isGroupPage(self.request, test):
+                result = self.request.normalizePagename(test)
+                self.assertEqual(result, expected,
+                                 ('Expected "%(expected)s" but got "%(result)s"') %
+                                 locals())
+
+
+class TestHTTPDate(unittest.TestCase):
+
+    def testRFC1123Date(self):
+        """ request: httpDate default rfc1123 """
+        self.failUnlessEqual(self.request.httpDate(0),
+                             'Thu, 01 Jan 1970 00:00:00 GMT',
+                             'wrong date string')
+
+    def testRFC850Date(self):
+        """ request: httpDate rfc850 """
+        self.failUnlessEqual(self.request.httpDate(0, rfc='850'),
+                             'Thursday, 01-Jan-70 00:00:00 GMT',
+                             'wrong date string')
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/search/_tests/test_search.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,36 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - MoinMoin.search Tests
+
+    @copyright: 2005 by Nir Soffer <nirs@freeshell.org>
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+from MoinMoin import search
+
+
+class TestQuotingBug(unittest.TestCase):
+    """search: quoting bug tests 
+    
+    http://moinmoin.wikiwikiweb.de/MoinMoinBugs/SearchOneCharString
+    
+    This is only a little stupid test for the isQuoted method, because
+    testing parsed queries is much more work.
+    """
+
+    def setUp(self):
+        self.parser = search.QueryParser()
+
+    def testIsQuoted(self):
+        """ search: quoting bug - quoted terms """
+        for case in ('"yes"', "'yes'"):
+            self.assertEqual(self.parser.isQuoted(case), True)
+
+    def testIsNot(self):
+        """ search: quoting bug - unquoted terms """
+        tests = ('', "'", '"', '""', "''", "'\"", '"no', 'no"', "'no",
+                 "no'", '"no\'')
+        for case in tests:
+            self.assertEqual(self.parser.isQuoted(case), False)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/security/_tests/test_security.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,277 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - MoinMoin.security Tests
+
+    TODO: when refactoring this, do not use "iter" (is a builtin)
+
+    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>
+                2007 by MoinMoin:ReimarBauer
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import py
+import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+from MoinMoin import security
+
+acliter = security.ACLStringIterator
+
+class TestACLStringIterator(unittest.TestCase):
+
+    def setUp(self):
+        self.config = self.TestConfig(defaults=['acl_rights_valid', 'acl_rights_before'])
+    def tearDown(self):
+        del self.config
+
+    def testEmpty(self):
+        """ security: empty acl string raise StopIteration """
+        iter = acliter(self.request.cfg.acl_rights_valid, '')
+        self.failUnlessRaises(StopIteration, iter.next)
+
+    def testWhiteSpace(self):
+        """ security: white space acl string raise StopIteration """
+        iter = acliter(self.request.cfg.acl_rights_valid, '       ')
+        self.failUnlessRaises(StopIteration, iter.next)
+
+    def testDefault(self):
+        """ security: default meta acl """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'Default Default')
+        for mod, entries, rights in iter:
+            self.assertEqual(entries, ['Default'])
+            self.assertEqual(rights, [])
+
+    def testEmptyRights(self):
+        """ security: empty rights """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'WikiName:')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['WikiName'])
+        self.assertEqual(rights, [])
+
+    def testSingleWikiNameSingleWrite(self):
+        """ security: single wiki name, single right """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'WikiName:read')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['WikiName'])
+        self.assertEqual(rights, ['read'])
+
+    def testMultipleWikiNameAndRights(self):
+        """ security: multiple wiki names and rights """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne,UserTwo:read,write')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['UserOne', 'UserTwo'])
+        self.assertEqual(rights, ['read', 'write'])
+
+    def testMultipleWikiNameAndRightsSpaces(self):
+        """ security: multiple names with spaces """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'user one,user two:read')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['user one', 'user two'])
+        self.assertEqual(rights, ['read'])
+
+    def testMultipleEntries(self):
+        """ security: multiple entries """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read,write UserTwo:read All:')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['UserOne'])
+        self.assertEqual(rights, ['read', 'write'])
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['UserTwo'])
+        self.assertEqual(rights, ['read'])
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['All'])
+        self.assertEqual(rights, [])
+
+    def testNameWithSpaces(self):
+        """ security: single name with spaces """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'user one:read')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['user one'])
+        self.assertEqual(rights, ['read'])
+
+    def testMultipleEntriesWithSpaces(self):
+        """ security: multiple entries with spaces """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'user one:read,write user two:read')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['user one'])
+        self.assertEqual(rights, ['read', 'write'])
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['user two'])
+        self.assertEqual(rights, ['read'])
+
+    def testMixedNames(self):
+        """ security: mixed wiki names and names with spaces """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne,user two:read,write user three,UserFour:read')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['UserOne', 'user two'])
+        self.assertEqual(rights, ['read', 'write'])
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['user three', 'UserFour'])
+        self.assertEqual(rights, ['read'])
+
+    def testModifier(self):
+        """ security: acl modifiers """
+        iter = acliter(self.request.cfg.acl_rights_valid, '+UserOne:read -UserTwo:')
+        mod, entries, rights = iter.next()
+        self.assertEqual(mod, '+')
+        self.assertEqual(entries, ['UserOne'])
+        self.assertEqual(rights, ['read'])
+        mod, entries, rights = iter.next()
+        self.assertEqual(mod, '-')
+        self.assertEqual(entries, ['UserTwo'])
+        self.assertEqual(rights, [])
+
+    def testIgnoreInvalidACL(self):
+        """ security: ignore invalid acl
+
+        The last part of this acl can not be parsed. If it ends with :
+        then it will be parsed as one name with spaces.
+        """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read user two is ignored')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['UserOne'])
+        self.assertEqual(rights, ['read'])
+        self.failUnlessRaises(StopIteration, iter.next)
+
+    def testEmptyNamesWithRight(self):
+        """ security: empty names with rights
+
+        The documents does not talk about this case, may() should ignore
+        the rights because there is no entry.
+        """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read :read All:')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['UserOne'])
+        self.assertEqual(rights, ['read'])
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, [])
+        self.assertEqual(rights, ['read'])
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['All'])
+        self.assertEqual(rights, [])
+
+    def testIgnodeInvalidRights(self):
+        """ security: ignore rights not in acl_rights_valid """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read,sing,write,drink,sleep')
+        mod, entries, rights = iter.next()
+        self.assertEqual(rights, ['read', 'write'])
+
+    def testBadGuy(self):
+        """ security: bad guy may not allowed anything
+
+        This test was failing on the apply acl rights test.
+        """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne:read,write BadGuy: All:read')
+        mod, entries, rights = iter.next()
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['BadGuy'])
+        self.assertEqual(rights, [])
+
+    def testAllowExtraWhitespace(self):
+        """ security: allow extra white space between entries """
+        iter = acliter(self.request.cfg.acl_rights_valid, 'UserOne,user two:read,write   user three,UserFour:read  All:')
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['UserOne', 'user two'])
+        self.assertEqual(rights, ['read', 'write'])
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['user three', 'UserFour'])
+        self.assertEqual(rights, ['read'])
+        mod, entries, rights = iter.next()
+        self.assertEqual(entries, ['All'])
+        self.assertEqual(rights, [])
+
+
+class TestAcl(unittest.TestCase):
+    """ security: testing access control list
+
+    TO DO: test unknown user?
+    """
+    def setUp(self):
+        # Backup user
+        self.config = self.TestConfig(defaults=['acl_rights_valid', 'acl_rights_before'])
+        self.savedUser = self.request.user.name
+
+    def tearDown(self):
+        # Restore user
+        self.request.user.name = self.savedUser
+        del self.config
+
+    def testApplyACLByUser(self):
+        """ security: applying acl by user name"""
+        # This acl string...
+        acl_rights = [
+            "Admin1,Admin2:read,write,delete,revert,admin  "
+            "Admin3:read,write,admin  "
+            "JoeDoe:read,write  "
+            "name with spaces,another one:read,write  "
+            "CamelCase,extended name:read,write  "
+            "BadGuy:  "
+            "All:read  "
+            ]
+        acl = security.AccessControlList(self.request.cfg, acl_rights)
+
+        # Should apply these rights:
+        users = (
+            # user,                 rights
+            # CamelCase names
+            ('Admin1',              ('read', 'write', 'admin', 'revert', 'delete')),
+            ('Admin2',              ('read', 'write', 'admin', 'revert', 'delete')),
+            ('Admin3',              ('read', 'write', 'admin')),
+            ('JoeDoe',              ('read', 'write')),
+            ('SomeGuy',             ('read',)),
+            # Extended names or mix of extended and CamelCase
+            ('name with spaces',    ('read','write',)),
+            ('another one',         ('read','write',)),
+            ('CamelCase',           ('read','write',)),
+            ('extended name',       ('read','write',)),
+            # Blocking bad guys
+            ('BadGuy',              ()),
+            # All other users - every one not mentioned in the acl lines
+            ('All',                 ('read',)),
+            ('Anonymous',           ('read',)),
+            )
+
+        # Check rights
+        for user, may in users:
+            mayNot = [right for right in self.request.cfg.acl_rights_valid
+                      if right not in may]
+            # User should have these rights...
+            for right in may:
+                self.assert_(acl.may(self.request, user, right),
+                    '"%(user)s" should be allowed to "%(right)s"' % locals())
+            # But NOT these:
+            for right in mayNot:
+                self.failIf(acl.may(self.request, user, right),
+                    '"%(user)s" should NOT be allowed to "%(right)s"' % locals())
+
+    def testACLsWithoutEditLogEntry(self):
+        """ tests what are the page rights if edit-log entry doesn't exist
+            for a page where no access is given to
+        """
+        py.test.skip("test tricks out the caching system, page modifications without making an edit-log entry are not supported")
+        import os
+        from MoinMoin.Page import Page
+        pagename = u'AutoCreatedMoinMoinTemporaryTestPage'
+
+        result = self.request.user.may.write(pagename)
+        page = Page(self.request, pagename)
+        path = page.getPagePath(use_underlay=0, check_create=0)
+        if os.path.exists(path):
+            py.test.skip("%s exists. Won't overwrite exiting page" % self.dictPage)
+
+        try:
+            try:
+                os.mkdir(path)
+                revisionsDir = os.path.join(path, 'revisions')
+                os.mkdir(revisionsDir)
+                current = '00000001'
+                file(os.path.join(path, 'current'), 'w').write('%s\n' % current)
+                text = u'#acl All: \n'
+                file(os.path.join(revisionsDir, current), 'w').write(text)
+            except Exception, err:
+                py.test.skip("Can not be create test page: %s" % err)
+    
+            assert not self.request.user.may.write(pagename)
+        finally:
+            if os.path.exists(path):
+                import shutil
+                shutil.rmtree(path, True)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/widget/_tests/test_html.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,66 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - MoinMoin.widget.html Tests
+
+    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+from MoinMoin.widget import html
+
+class TestHTMLWidgets(unittest.TestCase):
+    """widget.html: testing html widgets"""
+
+    def testCreate(self):
+        """widget.html: creating html widgets
+
+        TO DO: add tests for all elements by HTML 4 spec.
+        """
+        tests = (
+            # description, call, expected           
+            ('Create text', html.Text('<br> &'), '&lt;br&gt; &amp;'),
+            ('Create raw html', html.Raw('<br> &amp;'), '<br> &amp;'),
+            ('Create br', html.BR(), '<br>'),
+            ('Create hr', html.HR(), '<hr>'),
+            ('Create p', html.P(), '<p></p>'),
+            )
+
+        for description, obj, expected in tests:
+            result = unicode(obj)
+            self.assertEqual(result, expected,
+                             ('%(description)s: expected "%(expected)s" '
+                              'but got "%(result)s"') % locals())
+
+    def testInvalidAttributes(self):
+        """widegt.html: invalid attributes raises exception
+
+        TO DO: add tests for all elements by HTML 4 spec.
+        """
+        self.assertRaises(AttributeError, html.BR, name='foo')
+
+
+    def testCompositeElements(self):
+        """widget.html: append to and extend composite element"""
+        html._SORT_ATTRS = 1
+        element = html.P()
+
+        actions = (
+            # action, data, expected
+            (element.append,
+             html.Text('Text & '),
+             '<p>Text &amp; </p>'),
+            (element.append,
+             html.Text('more text. '),
+             '<p>Text &amp; more text. </p>'),
+            (element.extend,
+             (html.Text('And then '), html.Text('some.')),
+             '<p>Text &amp; more text. And then some.</p>'),
+            )
+
+        for action, data, expected in actions:
+            action(data)
+            result = unicode(element)
+            self.assertEqual(result, expected,
+                             'Expected "%(expected)s" but got "%(result)s"' % locals())
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/wikixml/_tests/test_marshal.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,56 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - MoinMoin.wikixml.marshal Tests
+
+    @copyright: 2002-2004 by Juergen Hermann <jh@web.de>
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+import array
+from MoinMoin.wikixml import marshal
+
+class TestMarshal(unittest.TestCase):
+    """Testing Marshal used for ...XXX"""
+
+    class Data:
+        cvar = 'Class Variable'
+        def __init__(self, value):
+            self.ivar = value
+
+    prop = (
+        # value, xml representation in a marshal object
+        (None, '<data><prop><none/></prop></data>'),
+        ("string", '<data><prop>string</prop></data>'),
+        ([1, "abc"], '<data><prop><item>1</item><item>abc</item></prop></data>'),
+        ((1, "abc"), '<data><prop><item>1</item><item>abc</item></prop></data>'),
+        ({"abc": 1}, '<data><prop><abc>1</abc></prop></data>'),
+        (1, '<data><prop>1</prop></data>'),
+        (Data('value'), '<data><prop><data><ivar>value</ivar></data></prop></data>'),
+        (array.array("i", [42]), "<data><prop>array('i', [42])</prop></data>"),
+        (buffer("0123456789", 2, 3), "<data><prop>234</prop></data>"),
+        )
+
+    def setUp(self):
+        self.obj = marshal.Marshal()
+
+    def testCreateMarshal(self):
+        """wikixml.marshal: create new marshal"""
+        self._checkData(self.obj, '<data></data>')
+
+    def testSetMarshalProperty(self):
+        """wikixml.marshal: setting marshal property"""
+        for value, xml in self.prop:
+            self.obj.prop = value
+            self._checkData(self.obj, xml)
+
+    def _canonize(self, xml):
+        xml = xml.replace('\n', '')
+        return xml
+
+    def _checkData(self, obj, xml):
+        objXML = self._canonize(obj.toXML())
+        expected = self._canonize(xml)
+        self.assertEqual(objXML, expected,
+            'Expected "%(expected)s" but got "%(objXML)s"' % locals())
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/xmlrpc/_tests/test_multicall.py	Sun Jul 01 02:43:32 2007 +0200
@@ -0,0 +1,28 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - MoinMoin.xmlrpc.xmlrpc_system_multicall Fault serialization
+
+    @copyright: 2007 by Karol Nowak <grywacz@gmail.com>
+    @license: GNU GPL, see COPYING for details.
+"""
+
+from MoinMoin.xmlrpc import XmlRpcBase
+from MoinMoin.request.CLI import Request
+from xmlrpclib import Fault
+
+def xmlrpc_return_fault():
+    return Fault(666, "Fault description")
+
+def test_fault_serialization():
+    xmlrpc = XmlRpcBase(Request())
+    xmlrpc.xmlrpc_return_fault = xmlrpc_return_fault
+    args = [{'methodName': 'return_fault', 'params': [ ]}]
+    
+    print """If a XML RPC method returns a Fault, we should get a failure response
+    instead of a serialized Fault, as it happened in the past. See revision
+    8b7d6d70fc95 for details"""
+    
+    result = xmlrpc.xmlrpc_system_multicall(args)
+    assert(type(result[0]) == dict)
+    assert(result[0].has_key("faultCode") and result[0].has_key("faultString"))
+    
\ No newline at end of file