r13328 - MoreFieldsAndWidgets/archetypes.referencebrowserwidget/branches/plip10778-plone.uuid/src/archetypes/referencebrowserwidget/tests

"Jean-Michel FRANCOIS" <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: toutpt
Date: Tue Dec  7 17:41:01 2010
New Revision: 13328

Modified:
   MoreFieldsAndWidgets/archetypes.referencebrowserwidget/branches/plip10778-plone.uuid/src/archetypes/referencebrowserwidget/tests/test_product.py
Log:
fix test_popup_items regex. If you use the new uuid from plone.uuid, uids have a different format.

Modified: MoreFieldsAndWidgets/archetypes.referencebrowserwidget/branches/plip10778-plone.uuid/src/archetypes/referencebrowserwidget/tests/test_product.py
==============================================================================
--- MoreFieldsAndWidgets/archetypes.referencebrowserwidget/branches/plip10778-plone.uuid/src/archetypes/referencebrowserwidget/tests/test_product.py	(original)
+++ MoreFieldsAndWidgets/archetypes.referencebrowserwidget/branches/plip10778-plone.uuid/src/archetypes/referencebrowserwidget/tests/test_product.py	Tue Dec  7 17:41:01 2010
@@ -19,6 +19,11 @@
 from Products.CMFCore.utils import getToolByName
 from Products.PloneTestCase.PloneTestCase import default_password
 from Products.PloneTestCase.PloneTestCase import portal_owner
+try:
+    import plone.uuid
+    HAS_UUID=True
+except:
+    HAS_UUID=False
 
 try:
     # Plone 4
@@ -560,16 +565,23 @@
 
         body = self.getNormalizedPopup()
         INSERTLINK = re.compile(r'<input type="checkbox" class="insertreference" rel="[0-9a-f]*?" />')
+        INSERTLINK_UUID = re.compile(r'<input type="checkbox" class="insertreference" rel="[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}" />')
 
         ROWS = re.compile(r'<tr.*?>(.*?)</tr>', re.MULTILINE|re.DOTALL)
         self.assertEqual(len(ROWS.findall(body)), wanted_rows)
-        self.assertEqual(len(INSERTLINK.findall(body)), wanted_insertlinks)
+        if HAS_UUID:
+            self.assertEqual(len(INSERTLINK_UUID.findall(body)), wanted_insertlinks)
+        else:
+            self.assertEqual(len(INSERTLINK.findall(body)), wanted_insertlinks)
 
         makeContent(self.portal, portal_type='News Item', id='newsitem')
         body = self.getNormalizedPopup()
 
         self.assertEqual(len(ROWS.findall(body)), wanted_rows + 1)
-        self.assertEqual(len(INSERTLINK.findall(body)), wanted_insertlinks)
+        if HAS_UUID:
+            self.assertEqual(len(INSERTLINK_UUID.findall(body)), wanted_insertlinks)
+        else:
+            self.assertEqual(len(INSERTLINK.findall(body)), wanted_insertlinks)
 
     def test_bc_navigationroot(self):
         makeContent(self.portal.folder1, portal_type='Document', id='page1')

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.