Commit 4f721c9a authored by Jérome Perrin's avatar Jérome Perrin

core_test: add unit tests for ERP5 Form

This reorganises a bit the tests to include the proxify feature of
ERP5 Form in ERP5 Form test
parent 0724cf98
......@@ -31,10 +31,51 @@ from Products.Formulator.TALESField import TALESMethod
from Products.ERP5Type.Core.Folder import Folder
from Products.ERP5Form.Form import field_value_cache
class TestProxify(ERP5TypeTestCase):
def getTitle(self):
return "Proxify"
class TestERP5Form(ERP5TypeTestCase):
def afterSetUp(self):
self.portal.portal_skins.custom.manage_addProduct[
'PageTemplates'].manage_addPageTemplate(
'Base_viewTestRenderer', 'Base_viewTestRenderer')
self.page_template = self.portal.portal_skins.custom.Base_viewTestRenderer
self.page_template.write('''
<html>
<form>
<tal:block tal:repeat="field form/get_fields">
<tal:block tal:replace="structure field/render" />
</tal:block>
</form>
</html>
''')
self.portal.portal_skins.custom.manage_addProduct['ERP5Form'].addERP5Form(
'Base_viewTest', 'Test')
self.form = self.portal.portal_skins.custom.Base_viewTest
self.form.manage_addField('my_string_field', 'String Field', 'StringField')
self.form.my_string_field.values['default'] = "test string field"
self.form.pt = self.page_template.getId()
def beforeTearDown(self):
self.abort()
for custom_skin in (self.form.getId(), self.page_template.getId(),):
if custom_skin in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects([custom_skin])
self.commit()
def test_call(self):
html = self.form()
self.assertIn("test string field", html)
def test_zmi(self):
# minimal tests for custom ZMI views
self.assertTrue(self.form.formProxify())
self.assertTrue(self.form.formUnProxify())
self.assertTrue(self.form.formShowRelatedProxyFields())
class TestProxify(ERP5TypeTestCase):
def afterSetUp(self):
# base field library
......
......@@ -8,15 +8,21 @@
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testProxify</string> </value>
<value> <string>testERP5Form</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Form.tests.testProxify</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testProxify</string> </value>
<value> <string>test.erp5.testERP5Form</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
test.erp5.testAccessTab
test.erp5.testSequence
test.erp5.testActivityTool
test.erp5.testAlarm
test.erp5.testArrow
......@@ -8,8 +7,8 @@ test.erp5.testAutoLogout
test.erp5.testBase
test.erp5.testBusinessTemplate
test.erp5.testCache
test.erp5.testCacheTool
test.erp5.testCachedSkinsTool
test.erp5.testCacheTool
test.erp5.testConstraint
test.erp5.testContributionRegistryTool
test.erp5.testCookieCrumbler
......@@ -20,6 +19,7 @@ test.erp5.testERP5Catalog
test.erp5.testERP5Category
test.erp5.testERP5Coordinate
test.erp5.testERP5Core
test.erp5.testERP5Form
test.erp5.testERP5Type
test.erp5.testERP5TypeInterfaces
test.erp5.testERP5Workflow
......@@ -42,11 +42,11 @@ test.erp5.testPerson
test.erp5.testPredicate
test.erp5.testPreferences
test.erp5.testPropertyRecordable
test.erp5.testProxify
test.erp5.testProxyField
test.erp5.testQueryModule
test.erp5.testRestrictedPythonSecurity
test.erp5.testSelectionTool
test.erp5.testSequence
test.erp5.testSessionTool
test.erp5.testTimeout
test.erp5.testTimerService
......
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