changeset 2313:e8b6de8fbcb4

Merge with my devel branch.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Fri, 22 Jun 2007 17:59:11 +0200
parents 1369b1f31497 (diff) a85d51778eda (current diff)
children 02824b69a95c
files
diffstat 6 files changed, 38 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_formatter.py	Fri Jun 22 17:58:23 2007 +0200
+++ b/MoinMoin/_tests/test_formatter.py	Fri Jun 22 17:59:11 2007 +0200
@@ -7,7 +7,6 @@
 """
 
 import py
-from unittest import TestCase
 
 import re
 
@@ -15,9 +14,9 @@
 from MoinMoin import wikiutil
 
 
-class TestFormatter(TestCase):
+class TestFormatter:
     def testSyntaxReferenceDomXml(self):
-        py.test.skip("dom_xml formatter is known broken")
+        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")
@@ -29,6 +28,7 @@
             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")
--- a/MoinMoin/_tests/test_packages.py	Fri Jun 22 17:58:23 2007 +0200
+++ b/MoinMoin/_tests/test_packages.py	Fri Jun 22 17:59:11 2007 +0200
@@ -6,7 +6,6 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from unittest import TestCase
 
 import py
 
@@ -15,6 +14,7 @@
 from MoinMoin.packages import Package, ScriptEngine, MOIN_PACKAGE_FILE, packLine, unpackLine
 
 
+
 class DebugPackage(Package, ScriptEngine):
     """ Used for debugging, does not need a real .zip file. """
     def __init__(self, request, filename, script=None):
@@ -26,6 +26,7 @@
 ReplaceUnderlay|testdatei|TestSeite2
 IgnoreExceptions|True
 DeletePage|TestSeiteDoesNotExist|Test ...
+DeletePage|FooPage|Test ...
 IgnoreExceptions|False
 AddRevision|foofile|FooPage
 AddRevision|foofile|FooPage
@@ -46,29 +47,40 @@
     def isPackage(self):
         return True
 
-class TestUnsafePackage(TestCase):
+
+class TestUnsafePackage:
     """ Tests various things in the packages package. Note that this package does
         not care to clean up and needs to run in a test wiki because of that. """
 
-    def setUp(self):
+    def setup_class(self):
         if not getattr(self.request.cfg, 'is_test_wiki', False):
             py.test.skip('This test needs to be run using the test wiki.')
 
-    def testBasicPackageThings(self):
-        myPackage = DebugPackage(self.request, 'test')
-        myPackage.installPackage()
-        self.assertEqual(myPackage.msg, "foo\n")
-        testseite2 = Page(self.request, 'TestSeite2')
-        self.assertEqual(testseite2.getPageText(), "Hello world, I am the file testdatei")
-        self.assert_(testseite2.isUnderlayPage())
 
-    def tearDown(self):
+    def teardown_class(self):
         DebugPackage(self.request, u"""moinmoinpackage|1
 DeletePage|FooPage|Test ...
 """).installPackage()
 
-class TestQuoting(TestCase):
+    def gain_superuser_rights(self):
+        self.request.user.name = "SuperUserName"
+        self.request.user.valid = 1
+        self.request.user.may.name = self.request.user.name
+        self.request.cfg.superuser.append(self.request.user.name)
+        self.request.user.auth_method = self.request.cfg.trusted_auth_methods[0]
+
+    def testBasicPackageThings(self):
+        self.gain_superuser_rights()
+        myPackage = DebugPackage(self.request, 'test')
+        myPackage.installPackage()
+        assert myPackage.msg == u'foo\nFooPage added \n'
+        testseite2 = Page(self.request, 'TestSeite2')
+        assert testseite2.getPageText() == "Hello world, I am the file testdatei"
+        assert testseite2.isUnderlayPage()
+
+
+class TestQuoting:
     def testQuoting(self):
         for line in ([':foo', 'is\\', 'ja|', u't|', u'baAz'], [], ['', '']):
-            self.assertEqual(line, unpackLine(packLine(line)))
+            assert line == unpackLine(packLine(line))
 
--- a/MoinMoin/_tests/test_wikisync.py	Fri Jun 22 17:58:23 2007 +0200
+++ b/MoinMoin/_tests/test_wikisync.py	Fri Jun 22 17:59:11 2007 +0200
@@ -6,7 +6,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from unittest import TestCase
+from unittest import TestCase # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
 
 import py
 
@@ -36,3 +36,4 @@
     def tearDown(self):
         tags = TagStore(self.page)
         tags.clear()
+
--- a/jabberbot/config.py	Fri Jun 22 17:58:23 2007 +0200
+++ b/jabberbot/config.py	Fri Jun 22 17:59:11 2007 +0200
@@ -42,4 +42,4 @@
     # configs for communication to work.
     #
     # CHANGE IT TO A LONG RANDOM STRING, OR YOU WILL HAVE A SECURITY ISSUE!
-    secret = u"8yFAS(E-,.c-93adj'uff;3AW#(UDJ,.df3OA($HG"
+    secret = u""
--- a/wiki/config/more_samples/jabber_wikiconfig.py	Fri Jun 22 17:58:23 2007 +0200
+++ b/wiki/config/more_samples/jabber_wikiconfig.py	Fri Jun 22 17:59:11 2007 +0200
@@ -173,5 +173,5 @@
     # configs for communication to work.
     #
     # CHANGE IT TO A LONG RANDOM STRING, OR YOU WILL HAVE A SECURITY ISSUE!
-    secret = u"8yFAS(E-,.c-93adj'uff;3AW#(UDJ,.df3OA($HG"
+    secret = u""
 
--- a/wikiconfig.py	Fri Jun 22 17:58:23 2007 +0200
+++ b/wikiconfig.py	Fri Jun 22 17:59:11 2007 +0200
@@ -26,3 +26,9 @@
     ]
     # ^^^ DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO ^^^
 
+    # developers, add your testing config values in this file
+    # (and don't add it to your repository):
+    try:
+        from wikiconfig_local import *
+    except ImportError:
+        pass