[Erp5-report] r45132 luke - /erp5/trunk/products/ERP5/tests/testBusinessTemplate.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 6 16:07:33 CEST 2011
Author: luke
Date: Wed Apr 6 16:07:33 2011
New Revision: 45132
URL: http://svn.erp5.org?rev=45132&view=rev
Log:
- check that local Document classes are correctly handled by Business Templates
Modified:
erp5/trunk/products/ERP5/tests/testBusinessTemplate.py
Modified: erp5/trunk/products/ERP5/tests/testBusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testBusinessTemplate.py?rev=45132&r1=45131&r2=45132&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] Wed Apr 6 16:07:33 2011
@@ -7360,6 +7360,76 @@ class TestBusinessTemplate(ERP5TypeTestC
new_bt5_obj.build()
template_tool.export(new_bt5_obj)
+ def stepCreateDocument(self, sequence=None, **kw):
+ document_title = 'UnitTest'
+ document_data = """class UnitTest:
+ meta_type = 'ERP5 Unit Test'
+ portal_type = 'Unit Test'"""
+ cfg = getConfiguration()
+ file_path = os.path.join(cfg.instancehome, 'Document', document_title+'.py')
+ if os.path.exists(file_path):
+ os.remove(file_path)
+ f = file(file_path, 'w')
+ f.write(document_data)
+ f.close()
+ self.failUnless(os.path.exists(file_path))
+ sequence.edit(document_title=document_title, document_path=file_path,
+ document_data=document_data)
+
+ def stepAddDocumentToBusinessTemplate(self, sequence=None, **kw):
+ bt = sequence['current_bt']
+ bt.edit(template_document_id_list=[sequence['document_title']])
+
+ def stepRemoveDocument(self, sequence=None, **kw):
+ document_title = sequence['document_title']
+ document_path = sequence['document_path']
+ os.remove(document_path)
+ self.failIf(os.path.exists(document_path))
+
+ def stepCheckDocumentExists(self, sequence=None, **kw):
+ self.failIf(not os.path.exists(sequence['document_path']))
+
+ def stepCheckDocumentRemoved(self, sequence=None, **kw):
+ self.failIf(os.path.exists(sequence['document_path']))
+
+ def test_BusinessTemplateWithDocument(self):
+ sequence_list = SequenceList()
+ sequence_string = '\
+ CreateDocument \
+ CreateNewBusinessTemplate \
+ UseExportBusinessTemplate \
+ AddDocumentToBusinessTemplate \
+ CheckModifiedBuildingState \
+ CheckNotInstalledInstallationState \
+ BuildBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ CheckObjectPropertiesInBusinessTemplate \
+ SaveBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ RemoveDocument \
+ RemoveBusinessTemplate \
+ RemoveAllTrashBins \
+ ImportBusinessTemplate \
+ UseImportBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ InstallBusinessTemplate \
+ Tic \
+ CheckInstalledInstallationState \
+ CheckBuiltBuildingState \
+ CheckNoTrashBin \
+ CheckSkinsLayers \
+ CheckDocumentExists \
+ UninstallBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ CheckDocumentRemoved \
+ '
+ sequence_list.addSequenceString(sequence_string)
+ sequence_list.play(self)
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestBusinessTemplate))
More information about the Erp5-report
mailing list