From 3fc05da0eb79b7238c6079ef5a6cd6e5cc5f2470 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Mon, 11 Apr 2011 15:49:06 +0000
Subject: [PATCH]  - remove Constraint testing, as it is done in own mixin and
 no code is required to test them

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45297 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testBusinessTemplate.py | 189 ---------------------
 1 file changed, 189 deletions(-)

diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py
index 5ef9c736fa..b176cb22a4 100644
--- a/product/ERP5/tests/testBusinessTemplate.py
+++ b/product/ERP5/tests/testBusinessTemplate.py
@@ -2420,92 +2420,6 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
     # Property Sheet will be installed in ZODB
     self.failUnless(getattr(self.portal.portal_property_sheets, ps_title, None) is not None)
 
-  # Test Constraint
-  def stepCreateConstraint(self, sequence=None, **kw):
-    """
-    Create a Constraint
-    """
-    ct_title = 'UnitTest'
-    ct_data =  ' \nclass UnitTest: \n  """ \n  Fake constraint for unit test \n \
-    """ \n  _properties = ( \n  ) \n  _categories = ( \n  ) \n\n'
-    cfg = getConfiguration()
-    file_path = os.path.join(cfg.instancehome, 'Constraint', ct_title+'.py')
-    if os.path.exists(file_path):
-      os.remove(file_path)
-    f = file(file_path, 'w')
-    f.write(ct_data)
-    f.close()
-    self.failUnless(os.path.exists(file_path))
-    sequence.edit(ct_title=ct_title, ct_path=file_path, ct_data=ct_data)
-
-  def stepAddConstraintToBusinessTemplate(self, sequence=None, **kw):
-    """
-    Add Constraint to Business Template
-    """
-    bt = sequence.get('current_bt', None)
-    self.failUnless(bt is not None)
-    ct_title = sequence.get('ct_title', None)
-    self.failUnless(ct_title is not None)
-    bt.edit(template_constraint_id_list=[ct_title])
-
-  def stepRemoveConstraint(self, sequence=None, sequencer_list=None, **kw):
-    """
-    Remove Constraint
-    """
-    ct_path = sequence.get('ct_path', None)
-    self.failUnless(ct_path is not None)
-    self.failUnless(os.path.exists(ct_path))
-    os.remove(ct_path)
-    self.failIf(os.path.exists(ct_path))
-
-  def stepCheckConstraintExists(self, sequence=None, sequencer_list=None, **kw):
-    """
-    Check presence of Constraint
-    """
-    ct_path = sequence.get('ct_path', None)
-    ct_data = sequence.get('ct_data', None)
-    self.failUnless(ct_path is not None)
-    self.failUnless(os.path.exists(ct_path))
-    # check data in property sheet
-    f = file(ct_path, 'r')
-    data = f.read()
-    self.assertEqual(data, ct_data)
-
-  def stepCheckConstraintRemoved(self, sequence=None, sequencer_list=None, **kw):
-    ct_path = sequence.get('ct_path', None)
-    self.failUnless(ct_path is not None)
-    self.failIf(os.path.exists(ct_path))
-
-  def stepCreateUpdatedConstraint(self, sequence=None, **kw):
-    """
-    Create a Constraint
-    """
-    ct_title = 'UnitTest'
-    ct_data =  ' \nclass UnitTest2: \n  """ \n  Second Fake constraint for unit test \n \
-    """ \n  _properties = ( \n  ) \n  _categories = ( \n  ) \n\n'
-    cfg = getConfiguration()
-    file_path = os.path.join(cfg.instancehome, 'Constraint', ct_title+'.py')
-    if os.path.exists(file_path):
-      os.remove(file_path)
-    f = file(file_path, 'w')
-    f.write(ct_data)
-    f.close()
-    self.failUnless(os.path.exists(file_path))
-    sequence.edit(ct_data_u=ct_data)
-
-  def stepCheckUpdatedConstraintExists(self, sequence=None, sequencer_list=None, **kw):
-    """
-    Check presence of Constraint
-    """
-    ct_path = sequence.get('ct_path', None)
-    ct_data = sequence.get('ct_data_u', None)
-    self.failUnless(ct_path is not None)
-    self.failUnless(os.path.exists(ct_path))
-    # check data in property sheet
-    f = file(ct_path, 'r')
-    data = f.read()
-    self.assertEqual(data, ct_data)
-
   # Busines templates
   def stepImportBusinessTemplate(self, sequence=None, **kw):
     """
@@ -4679,109 +4593,6 @@ class TestBusinessTemplate(BusinessTemplateMixin):
     sequence_list.addSequenceString(sequence_string)
     sequence_list.play(self)
 
-  def test_156_BusinessTemplateWithConstraint(self):
-    """Test Business Template With Constraint"""
-    sequence_list = SequenceList()
-    sequence_string = '\
-                       CreateConstraint \
-                       CreateNewBusinessTemplate \
-                       UseExportBusinessTemplate \
-                       AddConstraintToBusinessTemplate \
-                       CheckModifiedBuildingState \
-                       CheckNotInstalledInstallationState \
-                       BuildBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       CheckObjectPropertiesInBusinessTemplate \
-                       SaveBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       RemoveConstraint \
-                       RemoveBusinessTemplate \
-                       RemoveAllTrashBins \
-                       ImportBusinessTemplate \
-                       UseImportBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       InstallBusinessTemplate \
-                       Tic \
-                       CheckInstalledInstallationState \
-                       CheckBuiltBuildingState \
-                       CheckNoTrashBin \
-                       CheckSkinsLayers \
-                       CheckConstraintExists \
-                       UninstallBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       CheckConstraintRemoved \
-                       '
-    sequence_list.addSequenceString(sequence_string)
-    sequence_list.play(self)
-
-  def test_157_BusinessTemplateUpdateWithConstraint(self):
-    """Test Business Template With Constraint"""
-    sequence_list = SequenceList()
-    sequence_string = '\
-                       CreateConstraint \
-                       CreateNewBusinessTemplate \
-                       UseExportBusinessTemplate \
-                       AddConstraintToBusinessTemplate \
-                       CheckModifiedBuildingState \
-                       CheckNotInstalledInstallationState \
-                       BuildBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       CheckObjectPropertiesInBusinessTemplate \
-                       SaveBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       RemoveConstraint \
-                       RemoveBusinessTemplate \
-                       RemoveAllTrashBins \
-                       ImportBusinessTemplate \
-                       UseImportBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       InstallBusinessTemplate \
-                       Tic \
-                       CheckInstalledInstallationState \
-                       CheckBuiltBuildingState \
-                       CheckNoTrashBin \
-                       CheckSkinsLayers \
-                       CheckConstraintExists \
-                       RemoveConstraint \
-                       CreateUpdatedConstraint \
-                       CreateNewBusinessTemplate \
-                       UseExportBusinessTemplate \
-                       AddConstraintToBusinessTemplate \
-                       CheckModifiedBuildingState \
-                       CheckNotInstalledInstallationState \
-                       BuildBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       CheckObjectPropertiesInBusinessTemplate \
-                       SaveBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       CreateConstraint \
-                       RemoveBusinessTemplate \
-                       RemoveAllTrashBins \
-                       ImportBusinessTemplate \
-                       UseImportBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       InstallBusinessTemplate \
-                       Tic \
-                       CheckUpdatedConstraintExists \
-                       UninstallBusinessTemplate \
-                       CheckBuiltBuildingState \
-                       CheckNotInstalledInstallationState \
-                       CheckConstraintRemoved \
-                       CheckWorkflowChainRemoved \
-                       '
-    sequence_list.addSequenceString(sequence_string)
-    sequence_list.play(self)
-
   def test_16_BusinessTemplateWithAllItems(self):
     """Test Business Template With All Items"""
     sequence_list = SequenceList()
-- 
2.30.9