I want to test if an exception was raised how can I do that?
In my file.py I have this function:
//file.py
def unlink(self):
for rec in self:
if rec.state in ('progress', 'done'):
raise ValidationError(_('Error!!))
return super(MyClass, self).unlink()
//test_file.py
my_obj.button_validate()
my_obj.unlink()
When adding : my_obj.unlink() in the function , I got the output in log like this:
raise ValidationError(_('Error!!'))
odoo.exceptions.ValidationError: Error!!
How can I add test if the validation error is shown or not ?