[prev in list] [next in list] [prev in thread] [next in thread]
List: kupu-checkins
Subject: [kupu-checkins] r14615 - in kupu/trunk/kupu/plone: . tests
From: duncan () codespeak ! net
Date: 2005-07-13 11:05:31
Message-ID: 20050713110531.673C727B5D () code1 ! codespeak ! net
[Download RAW message or body]
Author: duncan
Date: Wed Jul 13 13:05:28 2005
New Revision: 14615
Modified:
kupu/trunk/kupu/plone/html2captioned.py
kupu/trunk/kupu/plone/librarytool.py
kupu/trunk/kupu/plone/tests/output/linked.out
kupu/trunk/kupu/plone/tests/output/notcaptioned.out
kupu/trunk/kupu/plone/tests/output/notquoted.out
kupu/trunk/kupu/plone/tests/output/simple.out
kupu/trunk/kupu/plone/tests/runalltests.py
kupu/trunk/kupu/plone/tests/runme.cmd
kupu/trunk/kupu/plone/tests/test_html2captioned.py
kupu/trunk/kupu/plone/tests/test_resourcetypemapper.py
Log:
Fixed Plone unit tests so they all pass again (333 tests!)
Strangely it takes 10 seconds to pass all tests on Plone 2.0.5, but on Plone 2.1 it \
takes 56 seconds.
Modified: kupu/trunk/kupu/plone/html2captioned.py
==============================================================================
--- kupu/trunk/kupu/plone/html2captioned.py (original)
+++ kupu/trunk/kupu/plone/html2captioned.py Wed Jul 13 13:05:28 2005
@@ -43,7 +43,7 @@
CLASS_PATTERN = re.compile('\s*class=("[^"]*captioned[^"]*"|[^" \/>]+)')
IMAGE_TEMPLATE = '''\
<div class="%(class)s" style="width:%(width)spx;">
- <div style="width:%(width)s">
+ <div style="width:%(width)spx;">
%(tag)s
</div>
<div class="image-caption">
Modified: kupu/trunk/kupu/plone/librarytool.py
==============================================================================
--- kupu/trunk/kupu/plone/librarytool.py (original)
+++ kupu/trunk/kupu/plone/librarytool.py Wed Jul 13 13:05:28 2005
@@ -13,6 +13,7 @@
$Id$
"""
+import Acquisition
from Acquisition import aq_parent, aq_inner, aq_base
from Products.CMFCore.Expression import Expression
from Products.CMFCore.Expression import createExprContext
@@ -21,7 +22,7 @@
class KupuError(Exception): pass
-class KupuLibraryTool:
+class KupuLibraryTool(Acquisition.Implicit):
"""A tool to aid Kupu libraries"""
__implements__ = IKupuLibraryTool
Modified: kupu/trunk/kupu/plone/tests/output/linked.out
==============================================================================
--- kupu/trunk/kupu/plone/tests/output/linked.out (original)
+++ kupu/trunk/kupu/plone/tests/output/linked.out Wed Jul 13 13:05:28 2005
@@ -1,9 +1,9 @@
<div>Simple text containing an embedded image</div>
-<div class="image-left captioned">
- <div style="width:120">
- <a href="xyzzy" class="link"><img height="144" alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width="120"/></a> +<div \
class="image-left captioned" style="width:120px;"> + <div style="width:120px;">
+ <a href="xyzzy" class="link"><img height="144" alt="picture alt text" src="[url \
for 104ede98d4c7c8eaeaa3b984f7395979]" width="120"/></a> </div>
- <div class="image-caption" style="width:120px;">
+ <div class="image-caption">
Test image caption
</div>
</div>
Modified: kupu/trunk/kupu/plone/tests/output/notcaptioned.out
==============================================================================
--- kupu/trunk/kupu/plone/tests/output/notcaptioned.out (original)
+++ kupu/trunk/kupu/plone/tests/output/notcaptioned.out Wed Jul 13 13:05:28 2005
@@ -1,2 +1,2 @@
<div>Simple text containing an embedded image</div>
-<p><img class=image-left height="144" alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width="120"/></p> +<p><img \
class=image-left height="144" alt="picture alt text" src="[url for \
104ede98d4c7c8eaeaa3b984f7395979]" width="120"/></p>
Modified: kupu/trunk/kupu/plone/tests/output/notquoted.out
==============================================================================
--- kupu/trunk/kupu/plone/tests/output/notquoted.out (original)
+++ kupu/trunk/kupu/plone/tests/output/notquoted.out Wed Jul 13 13:05:28 2005
@@ -1,13 +1,13 @@
<div>IE doesn't always quote attributes</div>
-<div class="image-left captioned">
- <div style="width:120">
- <img height=144 alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width=120/> +<div class="image-left \
captioned" style="width:120px;"> + <div style="width:120px;">
+ <img height=144 alt="picture alt text" src="[url for \
104ede98d4c7c8eaeaa3b984f7395979]" width=120/> </div>
- <div class="image-caption" style="width:120px;">Test image caption</div>
+ <div class="image-caption">Test image caption</div>
</div>
-<div class="captioned">
- <div style="width:120">
- <img height=144 alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width=120/> +<div class="captioned" \
style="width:120px;"> + <div style="width:120px;">
+ <img height=144 alt="picture alt text" src="[url for \
104ede98d4c7c8eaeaa3b984f7395979]" width=120/> </div>
- <div class="image-caption" style="width:120px;">Test image caption</div>
+ <div class="image-caption">Test image caption</div>
</div>
Modified: kupu/trunk/kupu/plone/tests/output/simple.out
==============================================================================
--- kupu/trunk/kupu/plone/tests/output/simple.out (original)
+++ kupu/trunk/kupu/plone/tests/output/simple.out Wed Jul 13 13:05:28 2005
@@ -1,6 +1,6 @@
<div>Simple text containing an embedded image</div>
-<div class="image-left captioned">
- <div style="width:120"><img height="144" alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width="120"/> +<div \
class="image-left captioned" style="width:120px;"> + <div style="width:120px;"><img \
height="144" alt="picture alt text" src="[url for 104ede98d4c7c8eaeaa3b984f7395979]" \
width="120"/> </div>
- <div class="image-caption" style="width:120px;">Test image caption</div>
+ <div class="image-caption">Test image caption</div>
</div>
Modified: kupu/trunk/kupu/plone/tests/runalltests.py
==============================================================================
--- kupu/trunk/kupu/plone/tests/runalltests.py (original)
+++ kupu/trunk/kupu/plone/tests/runalltests.py Wed Jul 13 13:05:28 2005
@@ -20,7 +20,6 @@
tests = [n[:-3] for n in tests if n.startswith('test') and n.endswith('.py')]
for test in tests:
- print "***", test
m = __import__(test)
if hasattr(m, 'test_suite'):
suite.addTest(m.test_suite())
Modified: kupu/trunk/kupu/plone/tests/runme.cmd
==============================================================================
--- kupu/trunk/kupu/plone/tests/runme.cmd (original)
+++ kupu/trunk/kupu/plone/tests/runme.cmd Wed Jul 13 13:05:28 2005
@@ -1,14 +1,15 @@
@echo off
setlocal
-set PLONEHOME=%1
+set PLONEHOME=%1"
set PLONEHOME=%PLONEHOME:"=%
if "%PLONEHOME%"=="" set PLONEHOME=c:\Plone20
set PYTHONPATH=%PLONEHOME%\Zope\lib\python
set PRODUCTS_PATH=%PLONEHOME%\Zope\lib\python\Products;%PLONEHOME%\Data\Products;%~D0%~P0..\..\..
set INSTANCE_HOME=%PLONEHOME%\Data
set SOFTWARE_HOME=%PLONEHOME%\Zope\lib\python
-"%PLONEHOME%\Python\python.exe" %~D0%~P0test_browserSupportsKupu.py
-"%PLONEHOME%\Python\python.exe" %~D0%~P0test_librarymanager.py
+rem "%PLONEHOME%\Python\python.exe" %~D0%~P0test_browserSupportsKupu.py
+rem "%PLONEHOME%\Python\python.exe" %~D0%~P0test_librarymanager.py
+rem "%PLONEHOME%\Python\python.exe" %~D0%~P0test_html2captioned.py
rem "%PLONEHOME%\Python\python.exe" %~D0%~P0test_resourcetypemapper.py
-rem "%PLONEHOME%\Python\python.exe" %~D0%~P0runalltests.py
+"%PLONEHOME%\Python\python.exe" %~D0%~P0runalltests.py
endlocal
Modified: kupu/trunk/kupu/plone/tests/test_html2captioned.py
==============================================================================
--- kupu/trunk/kupu/plone/tests/test_html2captioned.py (original)
+++ kupu/trunk/kupu/plone/tests/test_html2captioned.py Wed Jul 13 13:05:28 2005
@@ -3,16 +3,17 @@
execfile(os.path.join(sys.path[0], 'framework.py'))
from unittest import TestCase, TestSuite, main, makeSuite
+from Products.CMFPlone.tests import PloneTestCase
from os.path import join, abspath, dirname
-try:
- import Zope # Sigh, make product initialization happen
- HAS_ZOPE = 1
- Zope.startup()
-except ImportError:
- HAS_ZOPE = 0
-except AttributeError: # Zope > 2.6
- pass
+#try:
+# import Zope # Sigh, make product initialization happen
+# HAS_ZOPE = 1
+# Zope.startup()
+#except ImportError:
+# HAS_ZOPE = 0
+#except AttributeError: # Zope > 2.6
+# pass
from Products.PortalTransforms.tests.test_transforms import *
from Products.PortalTransforms.tests.utils import normalize_html
@@ -39,6 +40,8 @@
self.uid, self.description = uid, description
def Description(self):
return self.description
+ def absolute_url(self):
+ return '[url for %s]' % self.uid
class MockCatalogTool:
def lookupObject(self, uid):
Modified: kupu/trunk/kupu/plone/tests/test_resourcetypemapper.py
==============================================================================
--- kupu/trunk/kupu/plone/tests/test_resourcetypemapper.py (original)
+++ kupu/trunk/kupu/plone/tests/test_resourcetypemapper.py Wed Jul 13 13:05:28 2005
@@ -16,17 +16,37 @@
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
+import Acquisition
from Testing.ZopeTestCase import ZopeTestCase
+# from Products.CMFPlone.tests import PloneTestCase
from Products.kupu.plone.librarytool import KupuLibraryTool
+class FakeType:
+ def __init__(self, id, **kw):
+ self.id = id
+ for k in kw:
+ setattr(self, k, kw[k])
+
+class FakeTypeTool:
+ def listTypeInfo(self, container=None):
+ return [ FakeType(f)
+ for f in "Foo|Bar|Monkey|Ape|Nothing In Here Anymore|Bad Monkey|Bad \
Ape".split('|') ] +
+class FakePortal(Acquisition.Implicit):
+ absolute_url = lambda(self): None
+ portal_types = FakeTypeTool()
+
+
class TestIResourceTypeMapper(ZopeTestCase):
"""Test the implementation of IResourceMapper in KupuLibraryTool"""
def afterSetUp(self):
+ self.portal = FakePortal()
self.type_map = self.prepare()
def prepare(self):
type_map = KupuLibraryTool()
+ type_map = type_map.__of__(self.portal)
type_map.addResourceType("foobar", ("Foo", "", "Bar"))
type_map.addResourceType("bonobo", ("Monkey", " Ape\n"))
return type_map
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic