Commit 051cbd03 authored by Jérome Perrin's avatar Jérome Perrin

test rendering with "broken" item and multi item fields (ie. where current

value is not in the list of possible values)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35013 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7b0c042a
...@@ -51,6 +51,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -51,6 +51,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
if not self.skin: if not self.skin:
raise NotImplementedError('Subclasses must define skin') raise NotImplementedError('Subclasses must define skin')
gender = self.portal.portal_categories.gender
if 'male' not in gender.objectIds():
gender.newContent(id='male')
self.portal.portal_caches.clearAllCache()
self.auth = 'ERP5TypeTestCase:' self.auth = 'ERP5TypeTestCase:'
person_module = self.portal.person_module person_module = self.portal.person_module
if person_module._getOb('pers', None) is None: if person_module._getOb('pers', None) is None:
...@@ -58,6 +63,9 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -58,6 +63,9 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
transaction.commit() transaction.commit()
self.tic() self.tic()
person_module.pers.setFirstName('Bob') person_module.pers.setFirstName('Bob')
person_module.pers.setGender(None)
person_module.pers.setCareerRole(None)
if person_module.pers._getOb('img', None) is None: if person_module.pers._getOb('img', None) is None:
person_module.pers.newContent(portal_type='Image', id='img') person_module.pers.newContent(portal_type='Image', id='img')
...@@ -223,6 +231,29 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -223,6 +231,29 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self.assertEquals('inline', content_disposition.split(';')[0]) self.assertEquals('inline', content_disposition.split(';')[0])
self._validate(response.getBody()) self._validate(response.getBody())
def test_form_view_category(self):
self.portal.person_module.pers.setGender('male')
response = self.publish('/%s/person_module/pers/Person_view'
% self.portal.getId(), basic=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_broken_category(self):
self.portal.person_module.pers.setGender('not exist')
self.portal.person_module.pers.setCareerRole('not exist')
response = self.publish('/%s/person_module/pers/Person_view'
% self.portal.getId(), basic=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_embedded_image(self): def test_form_view_embedded_image(self):
# with image # with image
response = self.publish('/%s/person_module/pers/Person_viewDetails' response = self.publish('/%s/person_module/pers/Person_viewDetails'
......
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