[CMF-checkins] CVS: Products/CMFDefault/tests -
test_Image.py:1.8.2.2
Yvo Schubbe
y.2005- at wcm-solutions.de
Tue Apr 5 05:25:21 EDT 2005
Update of /cvs-repository/Products/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv3869/CMFDefault/tests
Modified Files:
Tag: CMF-1_5-branch
test_Image.py
Log Message:
- replaced get_transaction() by the transaction API used in Zope 2.8
- added utils.transaction for Zope 2.7 compatibility
- replaced commit() by commit(1) in test_PortalFolder.py
- related import and whitespace cleanup
=== Products/CMFDefault/tests/test_Image.py 1.8.2.1 => 1.8.2.2 ===
--- Products/CMFDefault/tests/test_Image.py:1.8.2.1 Wed Nov 24 10:26:06 2004
+++ Products/CMFDefault/tests/test_Image.py Tue Apr 5 05:25:21 2005
@@ -1,20 +1,47 @@
+##############################################################################
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for Image module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
-import Zope
-Zope.startup()
+try:
+ import Zope2
+except ImportError:
+ # BBB: for Zope 2.7
+ import Zope as Zope2
+Zope2.startup()
from os.path import join as path_join
from cStringIO import StringIO
+from AccessControl.SecurityManagement import newSecurityManager
+from AccessControl.SecurityManagement import noSecurityManager
+from AccessControl.User import UnrestrictedUser
+try:
+ import transaction
+except ImportError:
+ # BBB: for Zope 2.7
+ from Products.CMFCore.utils import transaction
+
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
from Products.CMFCore.tests.base.testcase import RequestTest
from Products.CMFDefault import tests
from Products.CMFDefault.File import File
from Products.CMFDefault.Image import Image
-from AccessControl.SecurityManagement import newSecurityManager
-from AccessControl.SecurityManagement import noSecurityManager
-from AccessControl.User import UnrestrictedUser
TESTS_HOME = tests.__path__[0]
TEST_JPG = path_join(TESTS_HOME, 'TestImage.jpg')
@@ -81,7 +108,7 @@
self.site.invokeFactory('Folder', id='subfolder')
self.subfolder = self.site.subfolder
self.workflow = self.site.portal_workflow
- get_transaction().commit(1) # Make sure we have _p_jars
+ transaction.commit(1) # Make sure we have _p_jars
except:
self.tearDown()
raise
More information about the CMF-checkins
mailing list