[Erp5-report] r34350 nicolas.dumazet - /erp5/trunk/products/ERP5Form/tests/testListBox.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Apr 8 08:54:03 CEST 2010
Author: nicolas.dumazet
Date: Thu Apr 8 08:54:00 2010
New Revision: 34350
URL: http://svn.erp5.org?rev=34350&view=rev
Log:
add test for bug #1443
Modified:
erp5/trunk/products/ERP5Form/tests/testListBox.py
Modified: erp5/trunk/products/ERP5Form/tests/testListBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/tests/testListBox.py?rev=34350&r1=34349&r2=34350&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/tests/testListBox.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/tests/testListBox.py [utf8] Thu Apr 8 08:54:00 2010
@@ -42,6 +42,7 @@
from StringIO import StringIO
from Products.ERP5Form.Selection import Selection
from Products.ERP5Form.Form import ERP5Form
+from Products.Formulator.TALESField import TALESMethod
class DummyFieldStorage:
@@ -297,6 +298,45 @@
# Make sure that word is there
self.assertEqual(rendered_listbox.find(word) > 0, True)
+ def testCellKeywordInProxifiedListboxColumn(self):
+ """
+ Test that cell keyword is correctly interpreted when used in TALES
+ to render a cell of a ListBox.
+ First use cell in the ProxyField context, then use it in the listbox_xxx
+ context
+ """
+ portal = self.getPortal()
+ portal.ListBoxZuite_reset()
+
+ form = portal.Foo_viewListBoxProxyField
+ portal.foo_module.FooModule_createObjects()
+ here = portal.foo_module['0']
+ here.Foo_createObjects()
+
+ request = get_request()
+ request['here'] = here
+
+ transaction.commit()
+
+ listbox_title_column = form.listbox_title
+
+ self.assertTrue(listbox_title_column.is_delegated('default'))
+ self.assertEquals(listbox_title_column.get_recursive_tales('default')._text,
+ 'python: cell.getTitle()')
+ listboxline_list = form.listbox.get_value('default', render_format = 'list',
+ REQUEST = request)
+ first_item = dict(listboxline_list[1].getColumnItemList())
+ self.assertEquals(first_item['title'], 'Title 0')
+
+ # Use "cell" locally
+ listbox_title_column.manage_tales_surcharged_xmlrpc(
+ dict(default=TALESMethod('python: cell.getTitle() + " local"')))
+
+ listboxline_list = form.listbox.get_value('default', render_format = 'list',
+ REQUEST = request)
+ first_item = dict(listboxline_list[1].getColumnItemList())
+ self.assertEquals(first_item['title'], 'Title 0 local')
+
def _helperExtraAndCssInListboxLine(self, field_type, editable):
"""
Create a listbox_xxx field, in the hidden group, that defines
More information about the Erp5-report
mailing list