changeset 4752:e6190a499a7e

fixed permissions for nuke_page by adding become_trusted()
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 05 Jul 2009 16:22:42 +0200
parents 09c345615cd8
children 5db0151a2df3
files MoinMoin/_tests/test_packages.py MoinMoin/action/_tests/test_attachfile.py MoinMoin/macro/_tests/test_GetVal.py
diffstat 3 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_packages.py	Fri Jul 03 15:17:23 2009 +0100
+++ b/MoinMoin/_tests/test_packages.py	Sun Jul 05 16:22:42 2009 +0200
@@ -17,7 +17,7 @@
 from MoinMoin.action import AttachFile
 from MoinMoin.action.PackagePages import PackagePages
 from MoinMoin.packages import Package, ScriptEngine, MOIN_PACKAGE_FILE, ZipPackage, packLine, unpackLine
-from MoinMoin._tests import become_superuser, create_page, nuke_page
+from MoinMoin._tests import become_trusted, become_superuser, create_page, nuke_page
 from MoinMoin.Page import Page
 from MoinMoin.PageEditor import PageEditor
 
@@ -137,6 +137,7 @@
         return zip_file
 
     def testAttachments_after_page_creation(self):
+        become_trusted(self.request)
         pagename = u'PackageTestPageCreatedFirst'
         page = create_page(self.request, pagename, u"This page has not yet an attachments dir")
         script = u"""MoinMoinPackage|1
@@ -154,6 +155,7 @@
         os.unlink(zip_file)
 
     def testAttachments_without_page_creation(self):
+        become_trusted(self.request)
         pagename = u"PackageAttachmentAttachWithoutPageCreation"
         script = u"""MoinMoinPackage|1
 AddAttachment|1_attachment|my_test.txt|%(pagename)s
--- a/MoinMoin/action/_tests/test_attachfile.py	Fri Jul 03 15:17:23 2009 +0100
+++ b/MoinMoin/action/_tests/test_attachfile.py	Sun Jul 05 16:22:42 2009 +0200
@@ -56,7 +56,10 @@
         """
         Tests if AttachFile.getFilename creates the attachment dir on self.requesting
         """
+        become_trusted(self.request)
+
         filename = ""
+
         file_exists = os.path.exists(AttachFile.getFilename(self.request, self.pagename, filename))
 
         nuke_page(self.request, self.pagename)
--- a/MoinMoin/macro/_tests/test_GetVal.py	Fri Jul 03 15:17:23 2009 +0100
+++ b/MoinMoin/macro/_tests/test_GetVal.py	Sun Jul 05 16:22:42 2009 +0200
@@ -23,23 +23,24 @@
     def teardown_class(self):
         nuke_page(self.request, self.pagename)
 
-    def _test_macro(self, name, args):
-        m = make_macro(self.request, self.page)
+    def _test_macro(self, name, args, page):
+        m = make_macro(self.request, page)
         return m.execute(name, args)
 
     def testGetValNoACLs(self):
         """ macro GetVal test: 'reads VAR' """
-        self.page = create_page(self.request, self.pagename, u' VAR:: This is an example')
-        result = self._test_macro(u'GetVal', "%s,%s" % (self.pagename, u'VAR'))
+        page = create_page(self.request, self.pagename, u' VAR:: This is an example')
+        result = self._test_macro(u'GetVal', "%s,%s" % (self.pagename, u'VAR'), page)
         assert result == "This is an example"
 
     def testGetValAfterADictPageIsDeleted(self):
         """ macro GetVal test: 'reads Dict var after another Dict is removed' """
         request = self.request
+        become_trusted(request)
         page = create_page(request, u'SomeDict', u" EXAMPLE:: This is an example text")
         page.deletePage()
         page = create_page(request, self.pagename, u' VAR:: This is a brand new example')
-        result = self._test_macro(u'GetVal', "%s,%s" % (self.pagename, u'VAR'))
+        result = self._test_macro(u'GetVal', "%s,%s" % (self.pagename, u'VAR'), page)
         nuke_page(request, u'SomeDict')
         assert result == "This is a brand new example"