Commit dc471516 authored by Jérome Perrin's avatar Jérome Perrin

ERP5/NotificationTool: Raise ValueError when input data is invalid

parent bfa20420
......@@ -321,9 +321,7 @@ class NotificationTool(BaseTool):
person_value = catalog_tool.getResultValue(portal_type=portal_type_list,
reference=person)
if person_value is None:
# For backward compatibility. I recommend to use ValueError.(yusei)
raise IndexError, "Can't find person document which reference is '%s'" % person
else:
raise ValueError("Can't find person document which reference is '%s'" % person)
person = person_value
to_person_list.append(person)
......
......@@ -384,11 +384,9 @@ class TestNotificationTool(ERP5TypeTestCase):
sequence_list.play(self)
def test_09_InvalideRecipient(self):
self.assertRaises(
IndexError,
self.portal.portal_notifications.sendMessage,
recipient='UnknowUser', subject='Subject', message='Message'
)
with self.assertRaises(ValueError):
self.portal.portal_notifications.sendMessage(
recipient='UnknowUser', subject='Subject', message='Message')
def stepCheckPersonNotification(self, sequence=None,
sequence_list=None, **kw):
......
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