[Erp5-report] r8790 - /erp5/trunk/products/ERP5/tests/testBusinessTemplate.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jul 26 11:07:03 CEST 2006


Author: aurel
Date: Wed Jul 26 11:06:54 2006
New Revision: 8790

URL: http://svn.erp5.org?rev=8790&view=rev
Log:
add test to check that filesystem class in business template are well updated

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=8790&r1=8789&r2=8790&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testBusinessTemplate.py (original)
+++ erp5/trunk/products/ERP5/tests/testBusinessTemplate.py Wed Jul 26 11:06:54 2006
@@ -1346,7 +1346,7 @@
     f.write(ps_data)
     f.close()
     self.failUnless(os.path.exists(file_path))
-    sequence.edit(ps_title=ps_title, ps_path=file_path)
+    sequence.edit(ps_title=ps_title, ps_path=file_path, ps_data=ps_data)
 
   def stepAddPropertySheetToBusinessTemplate(self, sequence=None, sequence_list=None, **kw):
     """
@@ -1373,9 +1373,14 @@
     Check presence of Property Sheet
     """
     ps_path = sequence.get('ps_path', None)
+    ps_data = sequence.get('ps_data', None)
     self.failUnless(ps_path is not None)
     self.failUnless(os.path.exists(ps_path))
-
+    # check data in property sheet
+    f = file(ps_path, 'r')
+    data = f.read()
+    self.assertEqual(data, ps_data)
+    
   def stepCheckPropertySheetRemoved(self, sequence=None, sequencer_list=None, **kw):
     """
     Check presence of Property Sheet
@@ -1383,6 +1388,36 @@
     ps_path = sequence.get('ps_path', None)
     self.failUnless(ps_path is not None)
     self.failIf(os.path.exists(ps_path))
+
+  def stepCreateUpdatedPropertySheet(self, sequence=None, sequence_list=None, **kw):
+    """
+    Create a Property Sheet
+    """
+    ps_title = 'UnitTest'
+    ps_data =  ' \nclass UnitTest2: \n  """ \n  Second Fake property sheet for unit test \n \
+    """ \n  _properties = ( \n  ) \n  _categories = ( \n  ) \n\n'
+    cfg = getConfiguration()
+    file_path = os.path.join(cfg.instancehome, 'PropertySheet', ps_title+'.py')
+    if os.path.exists(file_path):
+      os.remove(file_path)
+    f = file(file_path, 'w')
+    f.write(ps_data)
+    f.close()
+    self.failUnless(os.path.exists(file_path))
+    sequence.edit(ps_data_u=ps_data)
+
+  def stepCheckUpdatedPropertySheetExists(self, sequence=None, sequencer_list=None, **kw):
+    """
+    Check presence of Property Sheet
+    """
+    ps_path = sequence.get('ps_path', None)
+    ps_data = sequence.get('ps_data_u', None)
+    self.failUnless(ps_path is not None)
+    self.failUnless(os.path.exists(ps_path))
+    # check data in property sheet
+    f = file(ps_path, 'r')
+    data = f.read()
+    self.assertEqual(data, ps_data)
 
   # Busines templates
   def stepImportBusinessTemplate(self, sequence=None, sequence_list=None, **kw):
@@ -2285,6 +2320,73 @@
     sequence_list.addSequenceString(sequence_string)
     sequence_list.play(self, quiet=quiet)
 
+
+  def test_155_BusinessTemplateUpdateWithPropertySheet(self, quiet=quiet, run=run_all_test):
+    if not run: return
+    if not quiet:
+      message = 'Test Business Template With Property Sheet'
+      ZopeTestCase._print('\n%s ' % message)
+      LOG('Testing... ', 0, message)
+    sequence_list = SequenceList()
+    sequence_string = '\
+                       CreatePropertySheet \
+                       CreateNewBusinessTemplate \
+                       UseExportBusinessTemplate \
+                       AddPropertySheetToBusinessTemplate \
+                       CheckModifiedBuildingState \
+                       CheckNotInstalledInstallationState \
+                       BuildBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       CheckObjectPropertiesInBusinessTemplate \
+                       SaveBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       RemovePropertySheet \
+                       RemoveBusinessTemplate \
+                       RemoveAllTrashBins \
+                       ImportBusinessTemplate \
+                       UseImportBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       InstallBusinessTemplate \
+                       Tic \
+                       CheckInstalledInstallationState \
+                       CheckBuiltBuildingState \
+                       CheckTrashBin \
+                       CheckSkinsLayers \
+                       CheckPropertySheetExists \
+                       RemovePropertySheet \
+                       CreateUpdatedPropertySheet \
+                       CreateNewBusinessTemplate \
+                       UseExportBusinessTemplate \
+                       AddPropertySheetToBusinessTemplate \
+                       CheckModifiedBuildingState \
+                       CheckNotInstalledInstallationState \
+                       BuildBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       CheckObjectPropertiesInBusinessTemplate \
+                       SaveBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       CreatePropertySheet \
+                       RemoveBusinessTemplate \
+                       RemoveAllTrashBins \
+                       ImportBusinessTemplate \
+                       UseImportBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       InstallBusinessTemplate \
+                       Tic \
+                       CheckUpdatedPropertySheetExists \
+                       UninstallBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       CheckPropertySheetRemoved \
+                       '
+    sequence_list.addSequenceString(sequence_string)
+    sequence_list.play(self, quiet=quiet)
 
   def test_16_BusinessTemplateWithAllItems(self, quiet=quiet, run=run_all_test):
     if not run: return




More information about the Erp5-report mailing list