From 1074beca362586a7dd6e7766785cff412e7c52a7 Mon Sep 17 00:00:00 2001 From: Yusuke Muraoka <yusuke@nexedi.com> Date: Thu, 4 Feb 2010 07:04:17 +0000 Subject: [PATCH] add test for well-known bug git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32248 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testBusinessTemplate.py | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py index 516ea480f7..1161b540c0 100644 --- a/product/ERP5/tests/testBusinessTemplate.py +++ b/product/ERP5/tests/testBusinessTemplate.py @@ -196,6 +196,39 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): bt = sequence.get('copy_bt') sequence.edit(current_bt=bt, export_bt=bt) + def stepBuildCopyCoreBusinessTemplate(self, sequence=None, + sequence_list=None, **kw): + """ + Build copied core bt + """ + bt = sequence.get('copy_bt') + self.assertEquals(bt.getTitle(), 'erp5_core') + bt.build() + + def stepInstallCopyCoreBusinessTemplate(self, sequence=None, + sequence_list=None, **kw): + """ + Install copied core bt + """ + bt = sequence.get('copy_bt') + self.assertEquals(bt.getTitle(), 'erp5_core') + self.assertEquals(bt.getInstallationState(), 'not_installed') + bt.install() + + def stepCheckOriginalAndCopyBusinessTemplate(self, sequence=None, + sequence_list=None, **kw): + original_bt = sequence.get('current_bt') + copy_bt = sequence.get('copy_bt') + self.assertEquals(original_bt.getBuildingState(), 'built') + self.assertEquals(copy_bt.getBuildingState(), 'built') + + for item_name in original_bt._item_name_list: + original_obj = getattr(original_bt, item_name) + copy_obj = getattr(copy_bt, item_name) + self.failIf(original_obj is None) + self.failIf(copy_obj is None) + self.assertEquals(original_obj.getKeys(), copy_obj.getKeys()) + def stepUseExportBusinessTemplate(self, sequence=None, sequence_list=None, **kw): """ @@ -5778,6 +5811,39 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet) + def test_164_checkCopyBuild(self, quiet=quiet, run=run_all_test): + if not run: return + if not quiet: + message = 'Test Check basic copy and build is working' + ZopeTestCase._print('\n%s ' % message) + LOG('Testing... ', 0, message) + sequence_list = SequenceList() + sequence_string = '\ + UseCoreBusinessTemplate \ + CopyCoreBusinessTemplate \ + BuildCopyCoreBusinessTemplate \ + CheckOriginalAndCopyBusinessTemplate \ + ' + sequence_list.addSequenceString(sequence_string) + sequence_list.play(self, quiet=quiet) + + def test_165_checkCopyBuildInstall(self, quiet=quiet, run=run_all_test): + if not run: return + if not quiet: + message = 'Test Check basic copy, build and installation is working' + ZopeTestCase._print('\n%s ' % message) + LOG('Testing... ', 0, message) + sequence_list = SequenceList() + sequence_string = '\ + UseCoreBusinessTemplate \ + CopyCoreBusinessTemplate \ + BuildCopyCoreBusinessTemplate \ + InstallCopyCoreBusinessTemplate \ + ' + sequence_list.addSequenceString(sequence_string) + sequence_list.play(self, quiet=quiet) + + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestBusinessTemplate)) -- 2.30.9