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:
self.assertTrue(method())
def test_type_provider(self):
from Products.ERP5Type.Tool.TypesTool import TypeProvider
class DummyTypeProvider(TypeProvider):
id = 'dummy_type_provider'
# portal_type = 'Dummy Type Provider'
self.portal._setObject('dummy_type_provider', DummyTypeProvider())
self.portal.newContent(id='dummy_type_provider', portal_type="Types Tool")
types_tool = self.portal.portal_types
# register our dummy type provider
types_tool.type_provider_list = types_tool.type_provider_list + (
'dummy_type_provider',)
# types created in our type provider are available
dummy_type = self.portal.dummy_type_provider.newContent(
portal_type='Base Type',
id='Dummy Type',
type_factory_method_id='addFolder', )
type_class='Folder', )
transaction.commit()
self.tic()
# our type is available from types tool
self.assertNotEquals(None, types_tool.getTypeInfo('Dummy Type'))
......@@ -2904,10 +2903,13 @@ class TestPropertySheet:
# we can create instances from our type provider
container = self.portal.newContent(portal_type='Folder', id='test_folder')
dummy_instance = container.newContent(portal_type='Dummy Type')
# and use generated accessors on them
dummy_type.edit(type_property_sheet_list=('Reference', ))
transaction.commit()
self.tic()
dummy_instance.setReference('test')
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