Commit 059b6374 authored by Nicolas Dumazet's avatar Nicolas Dumazet

we cant create directly objects that are not portal types anymore.

Try to adapt the test to match what we would do with portal type classes.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42489 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 991a3000
...@@ -2876,22 +2876,21 @@ class TestPropertySheet: ...@@ -2876,22 +2876,21 @@ class TestPropertySheet:
self.assertTrue(method()) self.assertTrue(method())
def test_type_provider(self): def test_type_provider(self):
from Products.ERP5Type.Tool.TypesTool import TypeProvider self.portal.newContent(id='dummy_type_provider', portal_type="Types Tool")
class DummyTypeProvider(TypeProvider):
id = 'dummy_type_provider'
# portal_type = 'Dummy Type Provider'
self.portal._setObject('dummy_type_provider', DummyTypeProvider())
types_tool = self.portal.portal_types types_tool = self.portal.portal_types
# register our dummy type provider # register our dummy type provider
types_tool.type_provider_list = types_tool.type_provider_list + ( types_tool.type_provider_list = types_tool.type_provider_list + (
'dummy_type_provider',) 'dummy_type_provider',)
# types created in our type provider are available # types created in our type provider are available
dummy_type = self.portal.dummy_type_provider.newContent( dummy_type = self.portal.dummy_type_provider.newContent(
portal_type='Base Type', portal_type='Base Type',
id='Dummy Type', id='Dummy Type',
type_factory_method_id='addFolder', ) type_class='Folder', )
transaction.commit()
self.tic()
# our type is available from types tool # our type is available from types tool
self.assertNotEquals(None, types_tool.getTypeInfo('Dummy Type')) self.assertNotEquals(None, types_tool.getTypeInfo('Dummy Type'))
...@@ -2904,10 +2903,13 @@ class TestPropertySheet: ...@@ -2904,10 +2903,13 @@ class TestPropertySheet:
# we can create instances from our type provider # we can create instances from our type provider
container = self.portal.newContent(portal_type='Folder', id='test_folder') container = self.portal.newContent(portal_type='Folder', id='test_folder')
dummy_instance = container.newContent(portal_type='Dummy Type') dummy_instance = container.newContent(portal_type='Dummy Type')
# and use generated accessors on them # and use generated accessors on them
dummy_type.edit(type_property_sheet_list=('Reference', )) dummy_type.edit(type_property_sheet_list=('Reference', ))
transaction.commit()
self.tic()
dummy_instance.setReference('test') dummy_instance.setReference('test')
self.assertEquals('test', dummy_instance.getReference()) self.assertEquals('test', dummy_instance.getReference())
......
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