Commit 128df931 authored by Jérome Perrin's avatar Jérome Perrin

tests the alarm from r36399



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36400 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0647f87b
...@@ -79,6 +79,37 @@ class TestERP5Administration(InventoryAPITestCase): ...@@ -79,6 +79,37 @@ class TestERP5Administration(InventoryAPITestCase):
mvt.getParentValue()._delOb(mvt.getId()) mvt.getParentValue()._delOb(mvt.getId())
checkStock(row_count-2) # alarm.solve will unindex 'mvt' 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(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Administration)) suite.addTest(unittest.makeSuite(TestERP5Administration))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment