Commit 0dafa0a1 authored by Georgios Dagkakis's avatar Georgios Dagkakis

testBusinessTemplate: add two tests to check that having a space in id raises for

PythonScript and External Method
parent 3b0feea5
...@@ -61,6 +61,7 @@ Transform_manage_beforeDelete = Transform.manage_beforeDelete ...@@ -61,6 +61,7 @@ Transform_manage_beforeDelete = Transform.manage_beforeDelete
from Products.ERP5.Document.Organisation import Organisation from Products.ERP5.Document.Organisation import Organisation
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from ZODB.broken import Broken from ZODB.broken import Broken
from Products.ExternalMethod.ExternalMethod import manage_addExternalMethod
instance_home = os.environ['INSTANCE_HOME'] instance_home = os.environ['INSTANCE_HOME']
...@@ -6384,6 +6385,54 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -6384,6 +6385,54 @@ class TestBusinessTemplate(BusinessTemplateMixin):
""" """
self.test_168_CheckPortalTypeAndPathInSameBusinessTemplate(change_broken_object=True) self.test_168_CheckPortalTypeAndPathInSameBusinessTemplate(change_broken_object=True)
def test_170_check_python_script_with_space_in_id_is_not_allowed(self):
"""
Check that adding a PythonScript with space in id raises
"""
python_script_id = 'ERP5Site_dummyScriptWithSpaceInId '
skin_folder_id = 'custom'
if getattr(self.portal.portal_skins, skin_folder_id, None) is None:
self.portal.portal_skins.manage_addProduct['OFSP'].\
manage_addFolder(skin_folder_id)
skin_folder = self.portal.portal_skins[skin_folder_id]
self.assertRaises(
ValueError,
skin_folder.manage_addProduct['PythonScripts'].manage_addPythonScript,
id=python_script_id
)
def test_171_check_external_method_with_space_in_id_is_not_allowed(self):
"""
Check that adding an External Method with space in id raises
"""
document_id = 'document' + '.erp5.' + 'FooReference'
component = self.portal.portal_components.newContent(
id=document_id,
version='erp5',
title='FooReference',
reference='FooReference',
text_content='''def testFoo():
return 'foo'
''',
portal_type='Extension Component',
)
component.validate()
self.tic()
external_method_id = 'ERP5Site_dummyExternalMethodWithSpaceInId '
skin_folder_id = 'custom'
if getattr(self.portal.portal_skins, skin_folder_id, None) is None:
self.portal.portal_skins.manage_addProduct['OFSP'].\
manage_addFolder(skin_folder_id)
skin_folder = self.portal.portal_skins[skin_folder_id]
self.assertRaises(
ValueError,
skin_folder.manage_addProduct['ExternalMethod'].manage_addExternalMethod,
id=external_method_id,
title='',
module='FooReference',
function='testFoo',
)
def test_type_provider(self): def test_type_provider(self):
self.portal.newContent(id='dummy_type_provider', portal_type="Types Tool") self.portal.newContent(id='dummy_type_provider', portal_type="Types Tool")
type_provider = self.portal.dummy_type_provider type_provider = self.portal.dummy_type_provider
......
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