Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes
MoinMoin._tests.test_PageEditor.TestCopyPage Class Reference
Collaboration diagram for MoinMoin._tests.test_PageEditor.TestCopyPage:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setup_method
def teardown_method
def createTestPage
def deleteTestPage
def test_copy_page
def test_copy_page_acl_read
def test_copy_page_acl_no_read

Public Attributes

 savedValid
 text

Static Public Attributes

string pagename = u'AutoCreatedMoinMoinTemporaryTestPage'
string copy_pagename = u'AutoCreatedMoinMoinTemporaryCopyTestPage'
 shouldDeleteTestPage = True
string text = u'Example'

Detailed Description

Definition at line 216 of file test_PageEditor.py.


Member Function Documentation

Create temporary page, bypass logs, notification and backups

TODO: this code is very fragile, any change in the
implementation will break this test. Need to factor PageEditor
to make it possible to create page without loging and notifying.

Definition at line 231 of file test_PageEditor.py.

00231 
00232     def createTestPage(self):
00233         """ Create temporary page, bypass logs, notification and backups
00234 
00235         TODO: this code is very fragile, any change in the
00236         implementation will break this test. Need to factor PageEditor
00237         to make it possible to create page without loging and notifying.
00238         """
00239         import os
00240         path = Page(self.request, self.pagename).getPagePath(check_create=0)
00241         copy_path = Page(self.request, self.copy_pagename).getPagePath(check_create=0)
00242 
00243         if os.path.exists(path) or os.path.exists(copy_path):
00244             self.shouldDeleteTestPage = False
00245             py.test.skip("%s or %s exists. Won't overwrite exiting page" % (self.pagename, self.copy_pagename))
00246         try:
00247             os.mkdir(path)
00248             revisionsDir = os.path.join(path, 'revisions')
00249             os.mkdir(revisionsDir)
00250             current = '00000001'
00251             file(os.path.join(path, 'current'), 'w').write('%s\n' % current)
00252 
00253             file(os.path.join(revisionsDir, current), 'w').write(self.text)
00254         except Exception, err:
00255             py.test.skip("Can not be create test page: %s" % err)

Here is the call graph for this function:

Here is the caller graph for this function:

Delete temporary page, bypass logs and notifications 

Definition at line 256 of file test_PageEditor.py.

00256 
00257     def deleteTestPage(self):
00258         """ Delete temporary page, bypass logs and notifications """
00259         if self.shouldDeleteTestPage:
00260             import shutil
00261             shutil.rmtree(Page(self.request, self.pagename).getPagePath(), True)
00262             shutil.rmtree(Page(self.request, self.copy_pagename).getPagePath(), True)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 223 of file test_PageEditor.py.

00223 
00224     def setup_method(self, method):
00225         self.savedValid = self.request.user.valid
00226         self.request.user.valid = 1

Definition at line 227 of file test_PageEditor.py.

00227 
00228     def teardown_method(self, method):
00229         self.request.user.valid = self.savedValid
00230         self.deleteTestPage()

Here is the call graph for this function:

Tests copying a page without restricted acls

Definition at line 263 of file test_PageEditor.py.

00263 
00264     def test_copy_page(self):
00265         """
00266         Tests copying a page without restricted acls
00267         """
00268         self.createTestPage()
00269         result, msg = PageEditor(self.request, self.pagename).copyPage(self.copy_pagename)
00270         revision = Page(self.request, self.copy_pagename).current_rev()
00271         assert result and revision is 2

Here is the call graph for this function:

Tests copying a page without read rights

Definition at line 282 of file test_PageEditor.py.

00282 
00283     def test_copy_page_acl_no_read(self):
00284         """
00285         Tests copying a page without read rights
00286         """
00287         self.text = u'#acl SomeUser:read,write,delete All:\n'
00288         self.createTestPage()
00289         result, msg = PageEditor(self.request, self.pagename).copyPage(self.copy_pagename)
00290         revision = Page(self.request, self.copy_pagename).current_rev()
00291         assert result and revision is 2

Here is the call graph for this function:

Tests copying a page without write rights

Definition at line 272 of file test_PageEditor.py.

00272 
00273     def test_copy_page_acl_read(self):
00274         """
00275         Tests copying a page without write rights
00276         """
00277         self.text = u'#acl SomeUser:read,write,delete All:read\n'
00278         self.createTestPage()
00279         result, msg = PageEditor(self.request, self.pagename).copyPage(self.copy_pagename)
00280         revision = Page(self.request, self.copy_pagename).current_rev()
00281         assert result and revision is 2


Member Data Documentation

string MoinMoin._tests.test_PageEditor.TestCopyPage.copy_pagename = u'AutoCreatedMoinMoinTemporaryCopyTestPage' [static]

Definition at line 219 of file test_PageEditor.py.

string MoinMoin._tests.test_PageEditor.TestCopyPage.pagename = u'AutoCreatedMoinMoinTemporaryTestPage' [static]

Definition at line 218 of file test_PageEditor.py.

Definition at line 224 of file test_PageEditor.py.

Definition at line 220 of file test_PageEditor.py.

Definition at line 221 of file test_PageEditor.py.

Definition at line 276 of file test_PageEditor.py.


The documentation for this class was generated from the following file: