Commit 95fcf0a4 authored by Jérome Perrin's avatar Jérome Perrin

add a test to make sure accessor generation doesn't produce any warnings in the

log file.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8646 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 11c91236
...@@ -13,9 +13,10 @@ os.environ['EVENT_LOG_SEVERITY'] = '-300' ...@@ -13,9 +13,10 @@ os.environ['EVENT_LOG_SEVERITY'] = '-300'
from random import randint from random import randint
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG from zLOG import LOG, INFO
from Products.CMFCore.tests.base.testcase import LogInterceptor
class TestERP5Type(ERP5TypeTestCase): class TestERP5Type(ERP5TypeTestCase, LogInterceptor):
# Some helper methods # Some helper methods
...@@ -74,11 +75,7 @@ class TestERP5Type(ERP5TypeTestCase): ...@@ -74,11 +75,7 @@ class TestERP5Type(ERP5TypeTestCase):
# Create a business template and test if portal_type matches # Create a business template and test if portal_type matches
# Make a extension tests on basic accessors # Make a extension tests on basic accessors
portal_templates = self.getTemplateTool() portal_templates = self.getTemplateTool()
business_template = self.getTemplateTool().newContent(portal_type="Business Template") # Fails Why ? business_template = self.getTemplateTool().newContent(portal_type="Business Template")
# may be because there is
# no "Business Template"
# in portal_types, it may
# be added to erp5_common
self.failUnless(business_template.getPortalType() == 'Business Template') self.failUnless(business_template.getPortalType() == 'Business Template')
# Test simple string accessor # Test simple string accessor
test_string = self.getRandomString() test_string = self.getRandomString()
...@@ -285,6 +282,17 @@ class TestERP5Type(ERP5TypeTestCase): ...@@ -285,6 +282,17 @@ class TestERP5Type(ERP5TypeTestCase):
new_orga = folder[new_id] new_orga = folder[new_id]
self.assertEquals(new_orga.getTitle(), 'something') self.assertEquals(new_orga.getTitle(), 'something')
def test_AccessorGeneration(self):
"""Tests accessor generation doesn't generate error messages.
"""
from Products.ERP5Type.Base import _aq_reset
_aq_reset()
self._catch_log_errors(ignored_level=INFO)
folder = self.getOrganisationModule()
orga = folder.newContent(portal_type='Organisation',)
# call an accessor, _aq_dynamic will generate accessors
orga.getId()
self._ignore_log_errors()
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
......
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