[Erp5-report] r36400 jerome - /erp5/trunk/products/ERP5/tests/testERP5Administration.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jun 16 15:54:08 CEST 2010


Author: jerome
Date: Wed Jun 16 15:54:05 2010
New Revision: 36400

URL: http://svn.erp5.org?rev=36400&view=rev
Log:
tests the alarm from r36399


Modified:
    erp5/trunk/products/ERP5/tests/testERP5Administration.py

Modified: erp5/trunk/products/ERP5/tests/testERP5Administration.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Administration.py?rev=36400&r1=36399&r2=36400&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Administration.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Administration.py [utf8] Wed Jun 16 15:54:05 2010
@@ -79,6 +79,37 @@ class TestERP5Administration(InventoryAP
     mvt.getParentValue()._delOb(mvt.getId())
     checkStock(row_count-2) # alarm.solve will unindex 'mvt'
 
+  def test_check_consistency_alarm(self):
+    alarm = self.portal.portal_alarms.check_consistency
+    person = self.portal.person_module.newContent(portal_type='Person')
+    # this document will be non consistent, for PropertyTypeValidity
+    person.title = 3 
+    
+    alarm.activeSense()
+    transaction.commit()
+    self.tic()
+    
+    # some errors were detected
+    self.assertTrue(alarm.sense())
+    
+    # this alarm has a custom report
+    alarm.Alarm_viewConsistencyCheckReport()
+    # which has a listbox showing all problem reported by constraints and
+    # errors reported by property type validity constraint
+    line_list = alarm.Alarm_viewConsistencyCheckReport.listbox.get_value(
+                        'default', render_format='list')
+    self.assertEquals(1, len([line for line in line_list if line.isDataLine()]))
+    self.assertEquals(str(line_list[-1].getColumnProperty('getTranslatedMessage')),
+      "Attribute title should be of type string but is of type <type 'int'>")
+
+    # this alarm can solve, as long as the constraints can solve, this is the
+    # case of PropertyTypeValidity
+    alarm.solve()
+    transaction.commit()
+    self.tic()
+    self.assertEquals('3', person.title)
+
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestERP5Administration))




More information about the Erp5-report mailing list