From 134939b65eb848840536a244add49852d352b55e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Mon, 11 Apr 2011 15:50:51 +0000 Subject: [PATCH] - apply diet on TestBusinessTemplate and move some methods to proper test class git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45298 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testBusinessTemplate.py | 82 +++++++++++----------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py index b176cb22a4..409388f065 100644 --- a/product/ERP5/tests/testBusinessTemplate.py +++ b/product/ERP5/tests/testBusinessTemplate.py @@ -3214,58 +3214,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): self.assertEquals( 99, skin_folder.getProperty('business_template_skin_layer_priority')) - def stepCreateTest(self, sequence=None, **kw): - test_title = 'UnitTest' - test_data = """class UnitTest: - pass""" - cfg = getConfiguration() - file_path = os.path.join(cfg.instancehome, 'tests', test_title+'.py') - if os.path.exists(file_path): - os.remove(file_path) - f = file(file_path, 'w') - f.write(test_data) - f.close() - self.failUnless(os.path.exists(file_path)) - sequence.edit(test_title=test_title, test_path=file_path, - test_data=test_data) - - def stepAddTestToBusinessTemplate(self, sequence=None, **kw): - bt = sequence['current_bt'] - bt.edit(template_test_id_list=[sequence['test_title']]) - - def stepRemoveTest(self, sequence=None, **kw): - test_path = sequence['test_path'] - os.remove(test_path) - self.failIf(os.path.exists(test_path)) - - def stepCheckTestExists(self, sequence=None, **kw): - self.failIf(not os.path.exists(sequence['test_path'])) - - def stepCheckTestRemoved(self, sequence=None, **kw): - self.failIf(os.path.exists(sequence['test_path'])) - def stepCheckDocumentPropertySheetSameName(self, sequence=None, **kw): self.assertEqual(sequence['ps_title'], sequence['document_title']) self.assertEqual(os.path.basename(sequence['document_path']), os.path.basename(sequence['ps_path'])) - def stepCheckDocumentTestSameName(self, sequence=None, **kw): - self.assertEqual(sequence['test_title'], sequence['document_title']) - self.assertEqual(os.path.basename(sequence['document_path']), - os.path.basename(sequence['test_path'])) - def stepRemovePropertySheetFromBusinessTemplate(self, sequence=None, **kw): """ Add Property Sheet to Business Template """ sequence['current_bt'].edit(template_property_sheet_id_list=[]) - def stepRemoveTestFromBusinessTemplate(self, sequence=None, **kw): - """ - Add Property Sheet to Business Template - """ - sequence['current_bt'].edit(template_test_id_list=[]) - def stepCreateAllPropertySheetsFromFilesystem(self, sequence=None, **kw): self.portal.portal_property_sheets.createAllPropertySheetsFromFilesystem() @@ -7092,6 +7051,47 @@ class TestTestTemplateItem(TestDocumentTemplateItem): document_base_path = os.path.join(getConfiguration().instancehome, 'tests') template_property = 'template_test_id_list' + def stepCreateTest(self, sequence=None, **kw): + test_title = 'UnitTest' + test_data = """class UnitTest: + pass""" + cfg = getConfiguration() + file_path = os.path.join(cfg.instancehome, 'tests', test_title+'.py') + if os.path.exists(file_path): + os.remove(file_path) + f = file(file_path, 'w') + f.write(test_data) + f.close() + self.failUnless(os.path.exists(file_path)) + sequence.edit(test_title=test_title, test_path=file_path, + test_data=test_data) + + def stepAddTestToBusinessTemplate(self, sequence=None, **kw): + bt = sequence['current_bt'] + bt.edit(template_test_id_list=[sequence['test_title']]) + + def stepRemoveTest(self, sequence=None, **kw): + test_path = sequence['test_path'] + os.remove(test_path) + self.failIf(os.path.exists(test_path)) + + def stepCheckTestExists(self, sequence=None, **kw): + self.failIf(not os.path.exists(sequence['test_path'])) + + def stepCheckTestRemoved(self, sequence=None, **kw): + self.failIf(os.path.exists(sequence['test_path'])) + + def stepCheckDocumentTestSameName(self, sequence=None, **kw): + self.assertEqual(sequence['test_title'], sequence['document_title']) + self.assertEqual(os.path.basename(sequence['document_path']), + os.path.basename(sequence['test_path'])) + + def stepRemoveTestFromBusinessTemplate(self, sequence=None, **kw): + """ + Add Property Sheet to Business Template + """ + sequence['current_bt'].edit(template_test_id_list=[]) + def test_BusinessTemplateWithDocumentTestRemoved(self): """Checks that if Business Template defines Document and Test Document is not removed""" -- 2.30.9