Commit 16f34064 authored by Jérome Perrin's avatar Jérome Perrin

* separate form_view tests in 3 parts:

  - without listbox
  - with empty listbox
  - with non-empty listbox
* commit the transaction and reindex the person, so that tests for form_list shows a non-empty listbox



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17022 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e9ed698d
...@@ -50,6 +50,8 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -50,6 +50,8 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
person_module = self.portal.person_module person_module = self.portal.person_module
if not hasattr(person_module, 'pers'): if not hasattr(person_module, 'pers'):
person_module.newContent(id='pers', portal_type='Person') person_module.newContent(id='pers', portal_type='Person')
get_transaction().commit()
self.tic()
self.portal.changeSkin(self.skin) self.portal.changeSkin(self.skin)
self.validator = Validator() self.validator = Validator()
...@@ -74,6 +76,34 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -74,6 +76,34 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self._validate(response.getBody()) self._validate(response.getBody())
def test_form_view(self): def test_form_view(self):
# form_view on a form without listbox
self.portal.person_module.pers.setDefaultAddressZipCode(59000)
response = self.publish(
'/%s/person_module/pers/default_address/GeographicAddress_view'
% self.portal.getId(), self.auth)
self.assertEquals(HTTP_OK, response.getStatus())
content_type = response.getHeader('content-type')
self.assertTrue(content_type.startswith(self.content_type), content_type)
content_disposition = response.getHeader('content-disposition')
self.assertEquals('inline', content_disposition.split(';')[0])
self._validate(response.getBody())
def test_form_view_empty_listbox(self):
# form_view on a form with an empty listbox
if hasattr(self.portal.person_module.pers, 'default_address'):
self.portal.person_module.pers._delObject('default_address')
response = self.publish(
'/%s/person_module/pers/Person_view'
% self.portal.getId(), self.auth)
self.assertEquals(HTTP_OK, response.getStatus())
content_type = response.getHeader('content-type')
self.assertTrue(content_type.startswith(self.content_type), content_type)
content_disposition = response.getHeader('content-disposition')
self.assertEquals('inline', content_disposition.split(';')[0])
self._validate(response.getBody())
def test_form_view_non_empty_listbox(self):
self.portal.person_module.pers.setDefaultAddressZipCode(59000)
response = self.publish( response = self.publish(
'/%s/person_module/pers/Person_view' '/%s/person_module/pers/Person_view'
% self.portal.getId(), self.auth) % self.portal.getId(), self.auth)
......
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