Back to index

plone3  3.1.7
Public Member Functions
plone.app.linkintegrity.tests.layer.PloneLinkintegrity Class Reference
Inheritance diagram for plone.app.linkintegrity.tests.layer.PloneLinkintegrity:
Inheritance graph
[legend]
Collaboration diagram for plone.app.linkintegrity.tests.layer.PloneLinkintegrity:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown

Detailed Description

Definition at line 10 of file layer.py.


Member Function Documentation

Definition at line 13 of file layer.py.

00013 
00014     def setUp(cls):
00015         app = ZopeTestCase.app()
00016         portal = app.plone
00017 
00018         # login as admin (copied from `loginAsPortalOwner`)
00019         uf = app.acl_users
00020         user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf)
00021         newSecurityManager(None, user)
00022 
00023         # create sample content
00024         gif = 'R0lGODlhAQABAPAAAPj8+AAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
00025         gif = StringIO(decodestring(gif))
00026         portal.invokeFactory('Document', id='doc1', title='Test Page 1',
00027             text='<html> <body> a test page </body> </html>')
00028         portal.invokeFactory('Document', id='doc2', title='Test Page 2',
00029             text='<html> <body> another test page </body> </html>')
00030         portal.invokeFactory('Image', id='image1', title='Test Image 1', image=gif)
00031         portal.invokeFactory('Image', id='image2', title='Test Image 2', image=gif)
00032         portal.invokeFactory('Image', id='image3', title='Test Image 3', image=gif)
00033         portal.invokeFactory('File', id='file1', title='Test File 1', file=gif)
00034         portal.invokeFactory('Folder', id='folder1', title='Test Folder 1')
00035         portal.folder1.invokeFactory('Document', id='doc3', title='Test Page 3',
00036             text='<html> <body> a test page in a subfolder </body> </html>')
00037         portal.folder1.invokeFactory('Document', id='doc4', title='Test Page 4',
00038             text='<html> <body> another test page </body> </html>')
00039         portal.folder1.invokeFactory('Document', id='doc5', title='Test Page 5',
00040             text='<html> <body> another test page </body> </html>')
00041 
00042         # Unmark the creation flag so any calls processForm will not
00043         # rename our content objects.  This is mainly for getting the
00044         # tests running in combination with LinguaPlone.
00045         portal.doc1.unmarkCreationFlag()
00046         portal.doc2.unmarkCreationFlag()
00047         portal.image1.unmarkCreationFlag()
00048         portal.image2.unmarkCreationFlag()
00049         portal.image3.unmarkCreationFlag()
00050         portal.file1.unmarkCreationFlag()
00051         portal.folder1.unmarkCreationFlag()
00052         portal.folder1.doc3.unmarkCreationFlag()
00053         portal.folder1.doc4.unmarkCreationFlag()
00054         portal.folder1.doc5.unmarkCreationFlag()
00055 
00056         # starting with 2.10.4 product initialization gets delayed for
00057         # instance startup and is never called when running tests;  hence
00058         # we have to initialize the package method manually...
00059         from OFS.Application import install_package
00060         import plone.app.linkintegrity
00061         install_package(app, plone.app.linkintegrity, plone.app.linkintegrity.initialize)
00062 
00063         # create a starting point for the tests...
00064         commit()
00065         ZopeTestCase.close(app)

Definition at line 67 of file layer.py.

00067 
00068     def tearDown(cls):
00069         app = ZopeTestCase.app()
00070         portal = app.plone
00071 
00072         # login as admin (copied from `loginAsPortalOwner`)
00073         uf = app.acl_users
00074         user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf)
00075         newSecurityManager(None, user)
00076 
00077         # remove sample content
00078         ids = 'doc1', 'doc2', 'image1', 'image2', 'image3', 'folder1', 'file1'
00079         portal.manage_delObjects(ids=list(ids))
00080 
00081         # commit the cleanup...
00082         commit()
00083         ZopeTestCase.close(app)
00084 
00085 

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