tests cron: use repr() instead of its result (#38781)
This commit is contained in:
parent
b590eadcde
commit
4b7ec7775e
|
@ -15,8 +15,9 @@ def test_cron_frequencies(db):
|
|||
|
||||
def test_cron_error(db, caplog):
|
||||
connector = BaseAdresse.objects.create(slug='base-adresse')
|
||||
excep = Exception('hello')
|
||||
with mock.patch('passerelle.apps.base_adresse.models.BaseResource.hourly',
|
||||
new=mock.Mock(side_effect=Exception('hello'))):
|
||||
new=mock.Mock(side_effect=excep)):
|
||||
with pytest.raises(CommandError):
|
||||
call_command('cron', 'hourly')
|
||||
assert caplog.records[0].message == "error running hourly job (Exception('hello',))"
|
||||
assert caplog.records[0].message == "error running hourly job (%s)" % repr(excep)
|
||||
|
|
Loading…
Reference in New Issue