[Erp5-report] r45292 luke - /erp5/trunk/products/ERP5/tests/testBusinessTemplate.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Apr 11 17:00:40 CEST 2011
Author: luke
Date: Mon Apr 11 17:00:40 2011
New Revision: 45292
URL: http://svn.erp5.org?rev=45292&view=rev
Log:
- put document specific tests in document test
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=45292&r1=45291&r2=45292&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] Mon Apr 11 17:00:40 2011
@@ -3300,37 +3300,6 @@ class BusinessTemplateMixin(ERP5TypeTest
self.assertEquals(
99, skin_folder.getProperty('business_template_skin_layer_priority'))
- 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_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 stepCreateTest(self, sequence=None, **kw):
test_title = 'UnitTest'
test_data = """class UnitTest:
@@ -7048,53 +7017,159 @@ class TestBusinessTemplate(BusinessTempl
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
- def test_BusinessTemplateWithDocumentTestRemoved(self):
- """Checks that if Business Template defines Document and Test
- Document is not removed"""
+class TestDocumentTemplateItem(BusinessTemplateMixin):
+ document_title = 'UnitTest'
+ document_data = """class UnitTest:
+ meta_type = 'ERP5 Unit Test'
+ portal_type = 'Unit Test'"""
+ document_data_updated = """class UnitTest:
+ meta_type = 'ERP5 Unit Test'
+ portal_type = 'Unit Test'
+ def updated(self):
+ pass"""
+ document_base_path = os.path.join(getConfiguration().instancehome, 'Document')
+ template_property = 'template_document_id_list'
+
+ def stepCreateDocument(self, sequence=None, **kw):
+ file_path = os.path.join(self.document_base_path, self.document_title+'.py')
+ if os.path.exists(file_path):
+ os.remove(file_path)
+ f = file(file_path, 'w')
+ f.write(self.document_data)
+ f.close()
+ self.failUnless(os.path.exists(file_path))
+ sequence.edit(document_title=self.document_title, document_path=file_path,
+ document_data=self.document_data)
+
+ def stepCreateUpdatedDocument(self, sequence=None, **kw):
+ file_path = os.path.join(self.document_base_path, self.document_title+'.py')
+ if os.path.exists(file_path):
+ os.remove(file_path)
+ f = file(file_path, 'w')
+ f.write(self.document_data_updated)
+ f.close()
+ self.failUnless(os.path.exists(file_path))
+ sequence.edit(document_title=self.document_title, document_path=file_path,
+ document_data_updated=self.document_data_updated)
+
+ def stepAddDocumentToBusinessTemplate(self, sequence=None, **kw):
+ bt = sequence['current_bt']
+ bt.edit(**{self.template_property: [sequence['document_title']]})
+
+ def stepRemoveDocument(self, sequence=None, **kw):
+ 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']))
+ self.assertEqual(file(sequence['document_path']).read(),
+ sequence['document_data'])
+
+ def stepCheckUpdatedDocumentExists(self, sequence=None, **kw):
+ self.failIf(not os.path.exists(sequence['document_path']))
+ self.assertEqual(file(sequence['document_path']).read(),
+ sequence['document_data_updated'])
+
+ def stepCheckDocumentRemoved(self, sequence=None, **kw):
+ self.failIf(os.path.exists(sequence['document_path']))
+
+ def test_BusinessTemplateWithDocument(self):
sequence_list = SequenceList()
sequence_string = '\
CreateDocument \
- CreateTest \
- CheckDocumentTestSameName \
CreateNewBusinessTemplate \
UseExportBusinessTemplate \
AddDocumentToBusinessTemplate \
- AddTestToBusinessTemplate \
CheckModifiedBuildingState \
- ' + self.save_current_business_template_sequence_string + '\
+ CheckNotInstalledInstallationState \
+ BuildBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ CheckObjectPropertiesInBusinessTemplate \
+ SaveBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
RemoveDocument \
- RemoveTest \
RemoveBusinessTemplate \
RemoveAllTrashBins \
ImportBusinessTemplate \
UseImportBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
- InstallWithoutForceBusinessTemplate \
+ InstallBusinessTemplate \
Tic \
CheckInstalledInstallationState \
CheckBuiltBuildingState \
CheckNoTrashBin \
+ CheckSkinsLayers \
CheckDocumentExists \
- CheckTestExists \
- \
- CopyBusinessTemplate \
- Tic \
- \
- RemoveTestFromBusinessTemplate \
+ UninstallBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ CheckDocumentRemoved \
+ '
+ sequence_list.addSequenceString(sequence_string)
+ sequence_list.play(self)
+
+ def test_BusinessTemplateUpdateWithDocument(self):
+ sequence_list = SequenceList()
+ sequence_string = '\
+ CreateDocument \
+ CreateNewBusinessTemplate \
+ UseExportBusinessTemplate \
+ AddDocumentToBusinessTemplate \
CheckModifiedBuildingState \
- ' + self.save_current_business_template_sequence_string + '\
+ CheckNotInstalledInstallationState \
+ BuildBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ CheckObjectPropertiesInBusinessTemplate \
+ SaveBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ RemoveDocument \
+ RemoveBusinessTemplate \
+ RemoveAllTrashBins \
ImportBusinessTemplate \
UseImportBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
- InstallWithoutForceBusinessTemplate \
+ InstallBusinessTemplate \
Tic \
- \
CheckInstalledInstallationState \
CheckBuiltBuildingState \
- CheckTestRemoved \
+ CheckNoTrashBin \
+ CheckSkinsLayers \
CheckDocumentExists \
+ RemoveDocument \
+ CreateUpdatedDocument \
+ CreateNewBusinessTemplate \
+ UseExportBusinessTemplate \
+ AddDocumentToBusinessTemplate \
+ CheckModifiedBuildingState \
+ CheckNotInstalledInstallationState \
+ BuildBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ CheckObjectPropertiesInBusinessTemplate \
+ SaveBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ CreateDocument \
+ RemoveBusinessTemplate \
+ RemoveAllTrashBins \
+ ImportBusinessTemplate \
+ UseImportBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ InstallBusinessTemplate \
+ Tic \
+ CheckUpdatedDocumentExists \
+ UninstallBusinessTemplate \
+ CheckBuiltBuildingState \
+ CheckNotInstalledInstallationState \
+ CheckDocumentRemoved \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
@@ -7161,120 +7236,66 @@ class TestBusinessTemplate(BusinessTempl
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
-class TestDocumentTemplateItem(BusinessTemplateMixin):
- def test_BusinessTemplateWithDocument(self):
+class TestConstraintTemplateItem(TestDocumentTemplateItem):
+ def test(self):
+ raise NotImplemenetedError
+
+class TestExtensionTemplateItem(TestDocumentTemplateItem):
+ def test(self):
+ raise NotImplemenetedError
+
+class TestTestTemplateItem(TestDocumentTemplateItem):
+ def test_BusinessTemplateWithDocumentTestRemoved(self):
+ """Checks that if Business Template defines Document and Test
+ Document is not removed"""
sequence_list = SequenceList()
sequence_string = '\
CreateDocument \
+ CreateTest \
+ CheckDocumentTestSameName \
CreateNewBusinessTemplate \
UseExportBusinessTemplate \
AddDocumentToBusinessTemplate \
+ AddTestToBusinessTemplate \
CheckModifiedBuildingState \
- CheckNotInstalledInstallationState \
- BuildBusinessTemplate \
- CheckBuiltBuildingState \
- CheckNotInstalledInstallationState \
- CheckObjectPropertiesInBusinessTemplate \
- SaveBusinessTemplate \
- CheckBuiltBuildingState \
- CheckNotInstalledInstallationState \
+ ' + self.save_current_business_template_sequence_string + '\
RemoveDocument \
+ RemoveTest \
RemoveBusinessTemplate \
RemoveAllTrashBins \
ImportBusinessTemplate \
UseImportBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
- InstallBusinessTemplate \
+ InstallWithoutForceBusinessTemplate \
Tic \
CheckInstalledInstallationState \
CheckBuiltBuildingState \
CheckNoTrashBin \
- CheckSkinsLayers \
CheckDocumentExists \
- UninstallBusinessTemplate \
- CheckBuiltBuildingState \
- CheckNotInstalledInstallationState \
- CheckDocumentRemoved \
- '
- sequence_list.addSequenceString(sequence_string)
- sequence_list.play(self)
-
- def test_BusinessTemplateUpdateWithDocument(self):
- sequence_list = SequenceList()
- sequence_string = '\
- CreateDocument \
- CreateNewBusinessTemplate \
- UseExportBusinessTemplate \
- AddDocumentToBusinessTemplate \
+ CheckTestExists \
+ \
+ CopyBusinessTemplate \
+ Tic \
+ \
+ RemoveTestFromBusinessTemplate \
CheckModifiedBuildingState \
- CheckNotInstalledInstallationState \
- BuildBusinessTemplate \
- CheckBuiltBuildingState \
- CheckNotInstalledInstallationState \
- CheckObjectPropertiesInBusinessTemplate \
- SaveBusinessTemplate \
- CheckBuiltBuildingState \
- CheckNotInstalledInstallationState \
- RemoveDocument \
- RemoveBusinessTemplate \
- RemoveAllTrashBins \
+ ' + self.save_current_business_template_sequence_string + '\
ImportBusinessTemplate \
UseImportBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
- InstallBusinessTemplate \
+ InstallWithoutForceBusinessTemplate \
Tic \
+ \
CheckInstalledInstallationState \
CheckBuiltBuildingState \
- CheckNoTrashBin \
- CheckSkinsLayers \
+ CheckTestRemoved \
CheckDocumentExists \
- RemoveDocument \
- CreateUpdatedDocument \
- CreateNewBusinessTemplate \
- UseExportBusinessTemplate \
- AddDocumentToBusinessTemplate \
- CheckModifiedBuildingState \
- CheckNotInstalledInstallationState \
- BuildBusinessTemplate \
- CheckBuiltBuildingState \
- CheckNotInstalledInstallationState \
- CheckObjectPropertiesInBusinessTemplate \
- SaveBusinessTemplate \
- CheckBuiltBuildingState \
- CheckNotInstalledInstallationState \
- CreateDocument \
- RemoveBusinessTemplate \
- RemoveAllTrashBins \
- ImportBusinessTemplate \
- UseImportBusinessTemplate \
- CheckBuiltBuildingState \
- CheckNotInstalledInstallationState \
- InstallBusinessTemplate \
- Tic \
- CheckUpdatedDocumentExists \
- UninstallBusinessTemplate \
- CheckBuiltBuildingState \
- CheckNotInstalledInstallationState \
- CheckDocumentRemoved \
- CheckWorkflowChainRemoved \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
-class TestConstraintTemplateItem(TestDocumentTemplateItem):
- def test(self):
- raise NotImplemenetedError
-
-class TestExtensionTemplateItem(TestDocumentTemplateItem):
- def test(self):
- raise NotImplemenetedError
-
-class TestTestTemplateItem(TestDocumentTemplateItem):
- def test(self):
- raise NotImplemenetedError
-
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestBusinessTemplate))
More information about the Erp5-report
mailing list