[CMF-checkins] CVS: CMF/CMFCore/tests/base - testcase.py:1.9
Yvo Schubbe
y.2004_ at wcm-solutions.de
Mon Apr 26 08:14:47 EDT 2004
Update of /cvs-repository/CMF/CMFCore/tests/base
In directory cvs.zope.org:/tmp/cvs-serv5625/CMFCore/tests/base
Modified Files:
testcase.py
Log Message:
- removed pre Zope 2.6.4 compatibility code
- some whitespace, import and header cleanup
=== CMF/CMFCore/tests/base/testcase.py 1.8 => 1.9 ===
--- CMF/CMFCore/tests/base/testcase.py:1.8 Thu Apr 15 12:31:00 2004
+++ CMF/CMFCore/tests/base/testcase.py Mon Apr 26 08:14:16 2004
@@ -1,23 +1,22 @@
-import Zope
-try:
- Zope.startup()
-except AttributeError:
- # for Zope versions before 2.6.1
- pass
from unittest import TestCase
+import Zope
+Zope.startup()
+
+from os import curdir, mkdir, stat, remove
+from os.path import join, abspath, dirname
+from shutil import copytree, rmtree
+from tempfile import mktemp
+import sys
+import time
+
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
-from Testing.makerequest import makerequest
from security import PermissiveSecurityPolicy, AnonymousUser
+from Testing.makerequest import makerequest
+
from dummy import DummyFolder
-from os.path import join, abspath, dirname
-from os import curdir, mkdir, stat, remove
-from shutil import copytree,rmtree
-from tempfile import mktemp
-import os
-import sys
-import time
+
class TransactionalTest( TestCase ):
@@ -27,19 +26,21 @@
get_transaction().begin()
self.connection = Zope.DB.open()
self.root = self.connection.root()[ 'Application' ]
-
+
def tearDown( self ):
get_transaction().abort()
self.connection.close()
+
class RequestTest( TransactionalTest ):
-
+
def setUp(self):
TransactionalTest.setUp(self)
root = self.root = makerequest(self.root)
self.REQUEST = root.REQUEST
self.RESPONSE = root.REQUEST.RESPONSE
+
class SecurityTest( TestCase ):
def setUp(self):
@@ -56,8 +57,9 @@
noSecurityManager()
setSecurityPolicy(self._oldPolicy)
+
class SecurityRequestTest( SecurityTest ):
-
+
def setUp(self):
SecurityTest.setUp(self)
self.root = makerequest(self.root)
@@ -73,6 +75,7 @@
_prefix = abspath(join(_prefix,'..'))
+
class FSDVTest( TestCase ):
# Base class for FSDV test, creates a fake skin
# copy that can be edited.
@@ -88,7 +91,7 @@
if object is not None:
ob = self.ob = DummyFolder()
addDirectoryViews(ob, self._skinname, self.tempname)
-
+
def _writeFile(self, filename, stuff):
# write some stuff to a file on disk
# make sure the file's modification time has changed
@@ -142,7 +145,7 @@
f = open(fn, 'w')
f.write('Temporary file')
f.close()
- os.remove(fn)
+ remove(fn)
new_mtime = stat(self.skin_path_name)[8]
def setUp(self):
@@ -161,4 +164,3 @@
def tearDown(self):
# kill the copy
rmtree(self.tempname)
-
More information about the CMF-checkins
mailing list