changeset 2408:c3d3d7b7a048

Merge devel.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Mon, 16 Jul 2007 12:38:29 +0200
parents d2487ea5bcf2 (current diff) ca02fd95fe59 (diff)
children bf9fb139b5d3
files
diffstat 3 files changed, 29 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Sun Jul 15 23:53:24 2007 +0200
+++ b/MoinMoin/PageEditor.py	Mon Jul 16 12:38:29 2007 +0200
@@ -647,9 +647,6 @@
             raise self.AccessDenied, msg
 
         try:
-            event = PageDeletedEvent(request, self, comment)
-            send_event(event)
-
             msg = self.saveText(u"deleted\n", 0, comment=comment or u'', deleted=True, notify=False)
             msg = msg.replace(
                 _("Thank you for your changes. Your attention to detail is appreciated."),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/_tests/common.py	Mon Jul 16 12:38:29 2007 +0200
@@ -0,0 +1,14 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - MoinMoin.packages tests - common code
+
+    @copyright: 2007 MoinMoin:KarolNowak
+    @license: GNU GPL, see COPYING for details.
+"""
+
+def gain_superuser_rights(request):
+    request.user.name = "SuperUserName"
+    request.user.valid = 1
+    request.user.may.name = request.user.name
+    request.cfg.superuser.append(request.user.name)
+    request.user.auth_method = request.cfg.trusted_auth_methods[0]
--- a/MoinMoin/_tests/test_PageEditor.py	Sun Jul 15 23:53:24 2007 +0200
+++ b/MoinMoin/_tests/test_PageEditor.py	Mon Jul 16 12:38:29 2007 +0200
@@ -12,7 +12,7 @@
 
 from MoinMoin.Page import Page
 from MoinMoin.PageEditor import PageEditor
-
+from MoinMoin._tests.common import gain_superuser_rights
 
 class TestExpandVars(unittest.TestCase):
     """PageEditor: testing page editor"""
@@ -177,17 +177,23 @@
         from MoinMoin.events import Abort
         return Abort("This is just a test")
 
-    def dummy_write(self, *args, **kwargs):
-        print "PageEditor can't save a page if Abort is returned from PreSave event handlers"
-        assert False
+    pagename = u'AutoCreatedMoinMoinTemporaryTestPageFortestSave'
+    testtext = u'ThisIsSomeStupidTestPageText!'
 
-    pagename = u'AutoCreatedMoinMoinTemporaryTestPage'
-    testtext = u'ThisIsSomeStupidTestPageText!!'
-
+    gain_superuser_rights(request)
     cfg = request.cfg
     cfg.event_handlers = [handler]
 
+    page = Page(request, pagename)
+    if page.exists():
+        deleter = PageEditor(request, pagename)
+        deleter.deletePage()
+        print 'BODY:', deleter.body
+    
     editor = PageEditor(request, pagename)
-    editor._write_file = dummy_write
+    print 'BODY:', editor.body
     editor.saveText(testtext, 0)
-
+    
+    print "PageEditor can't save a page if Abort is returned from PreSave event handlers"
+    page = Page(request, pagename)
+    assert page.body != testtext