[Zope-Checkins] CVS: Packages/OFS/tests -
testFileAndImage.py:1.1.2.4
Stefan H. Holek
stefan at epy.co.at
Thu Jan 27 13:47:12 EST 2005
Update of /cvs-repository/Packages/OFS/tests
In directory cvs.zope.org:/tmp/cvs-serv4848/lib/python/OFS/tests
Modified Files:
Tag: Zope-2_7-branch
testFileAndImage.py
Log Message:
Collector #533: ZMI Find now searches in text Files.
=== Packages/OFS/tests/testFileAndImage.py 1.1.2.3 => 1.1.2.4 ===
--- Packages/OFS/tests/testFileAndImage.py:1.1.2.3 Fri Nov 5 10:00:54 2004
+++ Packages/OFS/tests/testFileAndImage.py Thu Jan 27 13:47:12 2005
@@ -1,3 +1,7 @@
+import Testing
+import Zope
+Zope.startup()
+
import os, sys
import unittest
import time
@@ -217,6 +221,25 @@
def testStr(self):
self.assertEqual(str(self.file), self.data)
+
+ def testFindSupport_not_text(self):
+ self.file.manage_edit('foobar', 'application/octet-stream',
+ filedata=''.join([chr(x) for x in range(256)]))
+ self.assertEqual(self.file.PrincipiaSearchSource(), '')
+
+ def testFindSupport_text(self):
+ self.file.manage_edit('foobar', 'text/plain',
+ filedata='Now is the time for all good men to '
+ 'come to the aid of the Party.')
+ self.failUnless('Party' in self.file.PrincipiaSearchSource())
+
+ def testFindFile(self):
+ self.file.manage_edit('foobar', 'text/plain',
+ filedata='Now is the time for all good men to '
+ 'come to the aid of the Party.')
+ results = self.app.ZopeFind(self.app, obj_searchterm='Party')
+ self.assertEqual(len(results), 1)
+ self.assertEqual(results[0][1], self.file)
class ImageTests(FileTests):
data = open(filedata, 'rb').read()
More information about the Zope-Checkins
mailing list