Commit 60b49d1b authored by Nicolas Delaby's avatar Nicolas Delaby

Test render_odg_view for IntegerFields and CheckBoxFields


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42705 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 55c8cf60
...@@ -259,6 +259,16 @@ class TestIntegerField(ERP5TypeTestCase): ...@@ -259,6 +259,16 @@ class TestIntegerField(ERP5TypeTestCase):
self.assertEquals(node.get('{%s}value' % NSMAP['office']), str(value)) self.assertEquals(node.get('{%s}value' % NSMAP['office']), str(value))
self.assertEquals(node.text, str(value)) self.assertEquals(node.text, str(value))
def test_render_odg_view(self):
self.field.values['default'] = 34
test_value = self.field.render_odg(as_string=False)\
.xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0]
self.assertEquals('34', test_value)
test_value = self.field.render_odg(value=0, as_string=False)\
.xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0]
self.assertEquals('0', test_value)
class TestStringField(ERP5TypeTestCase): class TestStringField(ERP5TypeTestCase):
"""Tests string field """Tests string field
""" """
...@@ -425,6 +435,19 @@ class TestCheckBoxField(ERP5TypeTestCase): ...@@ -425,6 +435,19 @@ class TestCheckBoxField(ERP5TypeTestCase):
str(value).lower()) str(value).lower())
self.assertEquals(node.text, str(value).upper()) self.assertEquals(node.text, str(value).upper())
def test_render_odg_view(self):
"""Like integer field
return 1 or 0
"""
self.field.values['default'] = 1
self.portal.REQUEST.set('editable_mode', 0)
test_value = self.field.render_odg(as_string=False)\
.xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0]
self.assertEquals('1', test_value)
test_value = self.field.render_odg(value=0, as_string=False)\
.xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0]
self.assertEquals('0', test_value)
class TestListField(ERP5TypeTestCase): class TestListField(ERP5TypeTestCase):
"""Tests List field """Tests List field
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment