Back to index

plone3  3.1.7
Functions | Variables
ZopeVersionControl.tests.common Namespace Reference

Functions

def get_transaction
def common_setUp
def common_tearDown
def common_commit

Variables

 get_transaction = get_transaction
 connection
 root
 responseOut
 app
 folder1
 folder2
 document1
 document2
 document_nonversion
 repository

Function Documentation

Definition at line 90 of file common.py.

00090 
00091 def common_commit(self):
00092     if self.do_commits:
00093         get_transaction().commit()
00094 

Definition at line 25 of file common.py.

00025 
00026 def common_setUp(self):
00027     # Install a hack to make SimpleItem version aware, so that the
00028     # tests work. In normal development, you would mix in the
00029     # VersionSupport class on an as-needed basis.
00030     import cStringIO
00031     from AccessControl.SecurityManagement import newSecurityManager
00032     from OFS.Application import Application
00033     from OFS.DTMLDocument import addDTMLDocument
00034     from OFS.Folder import manage_addFolder
00035     from Testing.makerequest import makerequest
00036 
00037     import Products.ZopeVersionControl
00038     Products.ZopeVersionControl.install_hack()
00039 
00040     from Products.ZopeVersionControl.ZopeRepository import addRepository
00041     from ZODB import DB
00042     from ZODB.DemoStorage import DemoStorage
00043     s = DemoStorage(quota=(1<<20))
00044     self.connection = DB( s ).open()
00045     try:
00046         r = self.connection.root()
00047         a = Application()
00048         r['Application'] = a
00049         self.root = a
00050         responseOut = self.responseOut = cStringIO.StringIO()
00051         self.app = makerequest( self.root, stdout=responseOut )
00052         self.app.acl_users.userFolderAddUser('UnitTester', '123', (), ())
00053         manage_addFolder(self.app, 'folder1')
00054         self.folder1 = getattr(self.app, 'folder1')
00055         manage_addFolder(self.folder1, 'folder2')
00056         self.folder2 = getattr(self.folder1, 'folder2')
00057         addDTMLDocument(self.folder2, 'document1', file='some text')
00058         self.document1 = getattr(self.folder2, 'document1')
00059         addDTMLDocument(self.folder2, 'document2', file='some text')
00060         self.document2 = getattr(self.folder2, 'document2')
00061         addDTMLDocument(self.folder2, 'document_nonversion', file='some?')
00062         self.document_nonversion = getattr(self.folder2,
00063                                             'document_nonversion')
00064         self.document_nonversion.__non_versionable__ = 1
00065         addRepository(self.folder1, 'repository')
00066         self.repository = getattr(self.folder1, 'repository')
00067         get_transaction().commit()            
00068     except:
00069         self.connection.close()
00070         raise
00071     get_transaction().begin()
00072     user = self.app.acl_users.getUser('UnitTester')
00073     user = user.__of__(self.app.acl_users)
00074     newSecurityManager( None, user)

Definition at line 75 of file common.py.

00075 
00076 def common_tearDown(self):
00077     from AccessControl.SecurityManagement import noSecurityManager
00078     noSecurityManager()
00079     del self.folder1
00080     del self.folder2
00081     del self.document1
00082     del self.document2
00083     get_transaction().abort()
00084     self.app._p_jar.sync()
00085     self.connection.close()
00086     del self.app
00087     del self.responseOut
00088     del self.root
00089     del self.connection

Definition at line 22 of file common.py.

00022 
00023     def get_transaction():
00024         return transaction


Variable Documentation

Definition at line 50 of file common.py.

Definition at line 43 of file common.py.

Definition at line 57 of file common.py.

Definition at line 59 of file common.py.

Definition at line 61 of file common.py.

Definition at line 53 of file common.py.

Definition at line 55 of file common.py.

Definition at line 20 of file common.py.

Definition at line 65 of file common.py.

Definition at line 49 of file common.py.

Definition at line 48 of file common.py.