[CMF-checkins] SVN: CMF/branches/tseaver-pkg_resources/CMFCore/
Repair remaining failing / broken CMFCore tests.
Tres Seaver
tseaver at palladion.com
Wed Oct 26 23:37:08 EDT 2005
Log message for revision 39664:
Repair remaining failing / broken CMFCore tests.
XXX: Still need more for DirectoryView-in-egg, as well as repairing
those broken in CMFDeafult.
Changed:
U CMF/branches/tseaver-pkg_resources/CMFCore/DirectoryView.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSFile.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSImage.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSMetadata.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSObject.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSPythonScript.py
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/base/testcase.py
A CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test4.py.metadata
D CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test4.py.security
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test6.py.metadata
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testDTML.dtml.metadata
A CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT.pt.metadata
D CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT.pt.properties
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT2.pt.metadata
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_directory.metadata
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_dtml.dtml.metadata
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_file.swf.metadata
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_file_two.swf.metadata
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_image.gif.metadata
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_DirectoryView.py
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSFile.py
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSMetadata.py
U CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSSecurity.py
-=-
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/DirectoryView.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/DirectoryView.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/DirectoryView.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -341,7 +341,7 @@
def _listEntries(self):
for entry in resource_listdir(self._pname, self._name):
- if entry not in self.ignore:
+ if entry not in self.ignore and not ignore_re.match(entry):
yield entry
def _getEntrySubpath(self, entry):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSFile.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSFile.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSFile.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -14,6 +14,7 @@
$Id$
"""
+import os
import Globals
from AccessControl import ClassSecurityInfo
@@ -49,7 +50,8 @@
def __init__(self, id, package=None, entry_subpath=None, filepath=None,
fullname=None, properties=None):
- id = fullname or id # Use the whole filename.
+ if fullname:
+ id = fullname # Use the whole filename.
FSObject.__init__(self, id, package, entry_subpath, filepath,
fullname, properties)
@@ -60,7 +62,7 @@
def _createZODBClone(self):
return File(self.getId(), '', self._readFile(1))
- def _get_content_type(self, file, body, id, content_type=None):
+ def _get_content_type(self, filename, body, id, content_type=None):
# Consult self.content_type first, this is either
# the default (unknown/unknown) or it got a value from a
# .metadata file
@@ -68,26 +70,27 @@
if getattr(self, 'content_type', default_type) != default_type:
return self.content_type
- # Next, look at file headers
- headers=getattr(file, 'headers', None)
- if headers and headers.has_key('content-type'):
- content_type=headers['content-type']
- else:
- # Last resort: Use the (imperfect) content type guessing
- # mechanism from OFS.Image, which ultimately uses the
- # Python mimetypes module.
- if not isinstance(body, basestring):
- body = body.data
- content_type, enc=guess_content_type(
- getattr(file, 'filename',id), body, content_type)
+ # Use the (imperfect) content type guessing
+ # mechanism from OFS.Image, which ultimately uses the
+ # Python mimetypes module.
+ if not isinstance(body, basestring):
+ body = body.data
+ content_type, enc = guess_content_type(filename, body, content_type)
+
return content_type
+ def _getFilename(self):
+ path = self._filepath or self._entry_subpath
+ dir, fn = os.path.split(self._filepath)
+ return fn
+
def _readFile(self, reparse):
data = self._readFileAsResourceOrDirect()
if reparse or self.content_type == 'unknown/unknown':
self.ZCacheable_invalidate()
- self.content_type=self._get_content_type(file, data, self.id)
+ filename = self._getFilename()
+ self.content_type = self._get_content_type(filename, data, self.id)
return data
#### The following is mainly taken from OFS/File.py ###
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSImage.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSImage.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSImage.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -64,7 +64,7 @@
return Image(self.getId(), '', self._readFile(1))
def _readFile(self, reparse):
- data = self._readFileAsResourceOrDirect()
+ data = self._data = self._readFileAsResourceOrDirect()
if reparse or self.content_type == 'unknown/unknown':
self.ZCacheable_invalidate()
ct, width, height = getImageInfo( data )
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSMetadata.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSMetadata.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSMetadata.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -62,10 +62,6 @@
def read(self):
""" Find the file(s) and read them.
-
- o Prefer new '.metdata' file.
-
- o Fall back to '.properties' and '.security' files.
"""
self._readMetadata()
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSObject.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSObject.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSObject.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -18,6 +18,8 @@
from os import path
from os import stat
from pkg_resources import resource_string
+from pkg_resources import get_provider
+import time
import Globals
from AccessControl import ClassSecurityInfo
@@ -57,6 +59,7 @@
_package = None
_entry_subpath = None
_file_mod_time = 0
+ _file_size = 0
_parsed = 0
def __init__(self, id, package=None, entry_subpath=None, filepath=None,
@@ -72,11 +75,6 @@
if package is not None or entry_subpath is not None:
raise ValueError(MESSAGE)
self._filepath = filepath
- fp = expandpath(self._filepath)
- try:
- self._file_mod_time = stat(fp)[8]
- except:
- pass
if properties:
# Since props come from the filesystem, this should be
@@ -91,7 +89,7 @@
self.id = id
self.__name__ = id # __name__ is used in traceback reporting
- self._readFile(0)
+ self._updateFromFS(reparse=1)
security.declareProtected(ViewManagementScreens, 'manage_doCustomize')
def manage_doCustomize(self, folder_path, RESPONSE=None):
@@ -147,7 +145,8 @@
obj = folder._getOb(id)
if RESPONSE is not None:
RESPONSE.redirect('%s/manage_main?manage_tabs_message=%s' % (
- obj.absolute_url(), html_quote("An object with this id already exists")
+ obj.absolute_url(),
+ html_quote("An object with this id already exists")
))
else:
folder._verifyObjectPaste(obj, validate_src=0)
@@ -176,24 +175,36 @@
# Refresh our contents from the filesystem if that is newer and we are
# running in debug mode.
- def _updateFromFS(self):
+ def _updateFromFS(self, reparse=1):
parsed = self._parsed
- if not parsed or Globals.DevelopmentMode:
+
+ if parsed and not Globals.DevelopmentMode:
+ return
+
+ if self._filepath:
fp = expandpath(self._filepath)
- try: mtime=stat(fp)[8]
- except: mtime=0
- if not parsed or mtime != self._file_mod_time:
- # if we have to read the file again, remove the cache
- self.ZCacheable_invalidate()
- self._readFile(1)
- self._file_mod_time = mtime
- self._parsed = 1
+ try:
+ statinfo = stat(fp)
+ size, mtime = statinfo[6], statinfo[8]
+ except:
+ size = mtime = 0
+ else:
+ size, mtime = _getZipStatInfo(self._package, self._entry_subpath)
+ if not parsed or mtime != self._file_mod_time:
+ # if we have to read the file again, remove the cache
+ self.ZCacheable_invalidate()
+ data = self._readFile(reparse)
+ self._file_mod_time = mtime
+ self._file_size = size
+ self._parsed = 1
+
security.declareProtected(View, 'get_size')
def get_size(self):
- """Get the size of the underlying file."""
- fp = expandpath(self._filepath)
- return path.getsize(fp)
+ """Get the size of the underlying file.
+ """
+ self._updateFromFS()
+ return self._file_size
security.declareProtected(View, 'getModTime')
def getModTime(self):
@@ -208,7 +219,9 @@
def getObjectFSPath(self):
"""Return the path of the file we represent"""
self._updateFromFS()
- return self._filepath
+ if self._filepath is not None:
+ return self._filepath
+ return '<zipimport: %s, %s>' % self._package, self._entry_subpath
security.declarePrivate('_readFileAsResourceOrDirect')
def _readFileAsResourceOrDirect(self):
@@ -272,25 +285,6 @@
"""
return self.showError( self, REQUEST )
- security.declarePrivate( '_readFile' )
- def _readFile( self, reparse ):
- """Read the data from the filesystem.
-
- Read the file indicated by exandpath(self._filepath), and parse the
- data if necessary. 'reparse' is set when reading the second
- time and beyond.
- """
- try:
- fp = expandpath(self._filepath)
- file = open(fp, 'rb')
- try:
- data = self.file_contents = file.read()
- finally:
- file.close()
- except: # No errors of any sort may propagate
- data = self.file_contents = None #give up
- return data
-
security.declarePublic( 'getFileContents' )
def getFileContents( self ):
"""
@@ -307,3 +301,22 @@
return self.exc_str
Globals.InitializeClass( BadFile )
+
+def _getZipStatInfo(package, subpath):
+ provider = get_provider(package)
+ zip_stat = provider.zipinfo.get(subpath)
+ if zip_stat is None:
+ return None, None
+ path, compression, csize, size, date, time, crc = zip_stat
+ date_time = ((date >> 9) + 1980, # year
+ (date >> 5) & 0xF, # month
+ date & 0x1F, # day
+ (time & 0xFFFF) >> 11, # hour
+ (time >> 5) & 0x3F, # minute
+ (time & 0x1F) * 2, # second
+ 0, # ?
+ 0, # ?
+ -1, # ?
+ )
+ return size, time.mktime(date_time)
+
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSPythonScript.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSPythonScript.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSPythonScript.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -236,7 +236,8 @@
self.func_defaults = None
self._body = ps._body
self._params = ps._params
- self.title = ps.title
+ if not self.title:
+ self.title = ps.title
self._setupBindings(ps.getBindingAssignments().getAssignedNames())
self._source = ps.read() # Find out what the script sees.
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/base/testcase.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/base/testcase.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/base/testcase.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -221,7 +221,10 @@
for name in files:
chmod(join(root, name), S_IREAD+S_IWRITE)
# store the skin path name
- self.skin_path_name = join(self.tempname,self._skinname,self._layername)
+ self.skin_path_name = join(self.tempname,
+ self._skinname,
+ self._layername,
+ )
def tearDown(self):
# kill the copy
Copied: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test4.py.metadata (from rev 39605, CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test4.py.security)
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test4.py.security 2005-10-24 22:04:59 UTC (rev 39605)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test4.py.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -0,0 +1,5 @@
+[Default]
+
+[Security]
+View = 1:Manager,Owner
+Access contents information = 0:
Deleted: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test4.py.security
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test4.py.security 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test4.py.security 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1,2 +0,0 @@
-View:acquire:Manager,Owner
-Access contents information::
\ No newline at end of file
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test6.py.metadata
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test6.py.metadata 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test6.py.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1,11 +1,8 @@
-[default]
+[Default]
title = Test object
cache = Default cache manager
proxy = Manager,Anonymous
-[security]
+[Security]
Access contents information = 1:Manager,Anonymous
View management screens = 0:Manager
-
-# [local]
-# local roles, not implemented yet
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testDTML.dtml.metadata
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testDTML.dtml.metadata 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testDTML.dtml.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1,2 +1,2 @@
-[default]
+[Default]
title=Zope Pope
Copied: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT.pt.metadata (from rev 39605, CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT.pt.properties)
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT.pt.properties 2005-10-24 22:04:59 UTC (rev 39605)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT.pt.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -0,0 +1,2 @@
+[Default]
+title=Zope Pope
Deleted: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT.pt.properties
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT.pt.properties 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT.pt.properties 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1 +0,0 @@
-title=Zope Pope
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT2.pt.metadata
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT2.pt.metadata 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/testPT2.pt.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1,2 +1,2 @@
-[default]
+[Default]
content_type = text/plain
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_directory.metadata
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_directory.metadata 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_directory.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1,2 +1,2 @@
-[default]
+[Default]
title = test_directory Title
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_dtml.dtml.metadata
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_dtml.dtml.metadata 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_dtml.dtml.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1,2 +1,2 @@
-[default]
+[Default]
proxy = Manager,Anonymous
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_file.swf.metadata
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_file.swf.metadata 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_file.swf.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1,6 +1,6 @@
-[default]
+[Default]
title=Test file
-[security]
+[Security]
Access contents information = 1:Manager,Anonymous
View management screens = 0:Manager
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_file_two.swf.metadata
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_file_two.swf.metadata 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_file_two.swf.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1,2 +1,2 @@
-[default]
+[Default]
content_type = application/x-shockwave-flash
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_image.gif.metadata
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_image.gif.metadata 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/fake_skins/fake_skin/test_image.gif.metadata 2005-10-27 03:37:08 UTC (rev 39664)
@@ -1,6 +1,6 @@
-[default]
+[Default]
title=Test image
-[security]
+[Security]
Access contents information = 1:Manager,Anonymous
View management screens = 0:Manager
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_DirectoryView.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_DirectoryView.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_DirectoryView.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -165,8 +165,9 @@
# Check if DirectoryView method works
self.assertEqual(self.ob.fake_skin.test1(),'test1')
- def test_properties(self):
- # Make sure the directory view is reading properties
+ def test_metadata(self):
+ # Make sure the directory view is reading .metadata files and
+ # assigning their values to subobjects.
self.assertEqual(self.ob.fake_skin.testPT.title, 'Zope Pope')
def test_ignored(self):
@@ -270,8 +271,9 @@
require('rotten')
import Products.Rotten
found = resource_listdir('Products.Rotten', 'skins/rotten')
- self.assertEqual(len(found), 1, found)
- self.assertEqual(found[0], 'rotten.pt')
+ self.assertEqual(len(found), 2, found)
+ self.failUnless('rotten.pt' in found)
+ self.failUnless('rotten.pt.metadata' in found)
def test_registerDirectory_in_egg(self):
from pkg_resources import require
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSFile.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSFile.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSFile.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -44,8 +44,10 @@
full_path = path_join(self.skin_path_name, filename)
metadata = FSMetadata(filepath=full_path)
metadata.read()
- fsfile_ob = FSFile(id, filepath=full_path,
- properties=metadata.getProperties())
+ fsfile_ob = FSFile(id,
+ filepath=full_path,
+ properties=metadata.getProperties(),
+ )
return fsfile_ob
def _extractFile( self, filename ):
@@ -95,7 +97,7 @@
self.assertEqual( self.RESPONSE.getHeader( 'Content-Length'.lower() )
, str(len(ref)) )
self.assertEqual( self.RESPONSE.getHeader( 'Content-Type'.lower() )
- , 'application/octet-stream' )
+ , 'application/x-shockwave-flash' )
self.assertEqual( self.RESPONSE.getHeader( 'Last-Modified'.lower() )
, rfc1123_date( mod_time ) )
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSMetadata.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSMetadata.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSMetadata.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -36,7 +36,7 @@
def test_basicPermissions(self):
# Test basic FS permissions
# check it has a title
- assert(self.ob.fake_skin.test6.title == 'Test object')
+ self.assertEqual(self.ob.fake_skin.test6.title, 'Test object')
self._checkSettings(
self.ob.fake_skin.test6,
'Access contents information',
@@ -54,7 +54,7 @@
def test_basicPermissionsOnImage(self):
# Test basic FS permissions on Image
test_image = getattr(self.ob.fake_skin, 'test_image.gif')
- assert(test_image.title == 'Test image')
+ self.assertEqual(test_image.title, 'Test image')
self._checkSettings(
test_image,
'Access contents information',
@@ -69,7 +69,7 @@
def test_basicPermissionsOnFile(self):
# Test basic FS permissions on File
test_file = getattr(self.ob.fake_skin, 'test_file.swf')
- assert(test_file.title == 'Test file')
+ self.assertEqual(test_file.title, 'Test file')
self._checkSettings(
test_file,
'Access contents information',
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSSecurity.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSSecurity.py 2005-10-27 02:54:20 UTC (rev 39663)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/tests/test_FSSecurity.py 2005-10-27 03:37:08 UTC (rev 39664)
@@ -60,9 +60,11 @@
# set up ZODB
RequestTest.setUp(self)
# put object in ZODB
- root=self.root
- try: root._delObject('fake_skin')
- except AttributeError: pass
+ root = self.root
+ try:
+ root._delObject('fake_skin')
+ except AttributeError:
+ pass
root._setObject( 'fake_skin', self.ob.fake_skin )
def tearDown( self ):
@@ -78,8 +80,10 @@
# check a normal method is as we'd expect
self._checkSettings(self.ob.fake_skin.test1,'View',1,[])
# now do some checks on the method with FS permissions
- self._checkSettings(self.ob.fake_skin.test4,'View',1,['Manager','Owner'])
- self._checkSettings(self.ob.fake_skin.test4,'Access contents information',0,[])
+ self._checkSettings(self.ob.fake_skin.test4,
+ 'View',1,['Manager','Owner'])
+ self._checkSettings(self.ob.fake_skin.test4,
+ 'Access contents information',0,[])
def test_invalidPermissionNames( self ):
import zLOG
More information about the CMF-checkins
mailing list